Compatibility code for executeScriptFile

This commit is contained in:
yinjimmy 2015-01-08 09:01:39 +08:00
parent 7d430742f1
commit 70e0874add
1 changed files with 14 additions and 11 deletions

View File

@ -285,17 +285,20 @@ int LuaStack::executeScriptFile(const char* filename)
// 2. check .luac suffix // 2. check .luac suffix
// //
std::string buf(filename); std::string buf(filename);
std::string tmpfilename = buf + NOT_BYTECODE_FILE_EXT; if (!utils->isFileExist(buf))
if (utils->isFileExist(tmpfilename))
{ {
buf = tmpfilename; std::string notBytecodeFilename = buf + NOT_BYTECODE_FILE_EXT;
if (utils->isFileExist(notBytecodeFilename))
{
buf = notBytecodeFilename;
} }
else else
{ {
tmpfilename = buf + BYTECODE_FILE_EXT; std::string bytecodeFilename = buf + BYTECODE_FILE_EXT;
if (utils->isFileExist(tmpfilename)) if (utils->isFileExist(bytecodeFilename))
{ {
buf = tmpfilename; buf = bytecodeFilename;
}
} }
} }