Quellcode durchsuchen

Fixed lua dofile on Windows
Fixed #909
Previously, on all platforms except windows, ScriptController modified the lua functions "dofile" and "loadfile" so that they will search in the directory FileSystem::getResourcePath(). I removed #ifndef WIN32 so that Windows will behave like this too.

Darryl Gough vor 13 Jahren
Ursprung
Commit
7748feb67b
1 geänderte Dateien mit 0 neuen und 4 gelöschten Zeilen
  1. 0 4
      gameplay/src/ScriptController.cpp

+ 0 - 4
gameplay/src/ScriptController.cpp

@@ -652,7 +652,6 @@ static const char* lua_print_function =
     "    ScriptController.print(table.concat({...},\"\\t\"), \"\\n\")\n"
     "    ScriptController.print(table.concat({...},\"\\t\"), \"\\n\")\n"
     "end\n";
     "end\n";
 
 
-#ifndef WIN32 
 static const char* lua_loadfile_function = 
 static const char* lua_loadfile_function = 
     "do\n"
     "do\n"
     "    local oldLoadfile = loadfile\n"
     "    local oldLoadfile = loadfile\n"
@@ -676,7 +675,6 @@ static const char* lua_dofile_function =
     "        return oldDofile(filename)\n"
     "        return oldDofile(filename)\n"
     "    end\n"
     "    end\n"
     "end\n";
     "end\n";
-#endif
 
 
 void ScriptController::initialize()
 void ScriptController::initialize()
 {
 {
@@ -694,13 +692,11 @@ void ScriptController::initialize()
     if (luaL_dostring(_lua, lua_print_function))
     if (luaL_dostring(_lua, lua_print_function))
         GP_ERROR("Failed to load custom print() function with error: '%s'.", lua_tostring(_lua, -1));
         GP_ERROR("Failed to load custom print() function with error: '%s'.", lua_tostring(_lua, -1));
 
 
-#ifndef WIN32
     // Change the functions that read a file to use FileSystem.getResourcePath as their base path.
     // Change the functions that read a file to use FileSystem.getResourcePath as their base path.
     if (luaL_dostring(_lua, lua_loadfile_function))
     if (luaL_dostring(_lua, lua_loadfile_function))
         GP_ERROR("Failed to load custom loadfile() function with error: '%s'.", lua_tostring(_lua, -1));
         GP_ERROR("Failed to load custom loadfile() function with error: '%s'.", lua_tostring(_lua, -1));
     if (luaL_dostring(_lua, lua_dofile_function))
     if (luaL_dostring(_lua, lua_dofile_function))
         GP_ERROR("Failed to load custom dofile() function with error: '%s'.", lua_tostring(_lua, -1));
         GP_ERROR("Failed to load custom dofile() function with error: '%s'.", lua_tostring(_lua, -1));
-#endif
 }
 }
 
 
 void ScriptController::initializeGame()
 void ScriptController::initializeGame()