diff --git a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp index b46a7c27dd..3b5304b351 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp @@ -807,6 +807,61 @@ tolua_lerror: return 0; } +int lua_cocos2dx_runtime_setSearchPaths(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::FileUtils* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_runtime_setSearchPaths'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::vector vecPaths; + + ok &= luaval_to_std_vector_string(tolua_S, 2,&vecPaths); + if(!ok) + return 0; + + for (int i = 0; i < vecPaths.size(); i++) + { + if (!FileUtils::getInstance()->isAbsolutePath(vecPaths[i])) + vecPaths[i] = g_resourcePath + vecPaths[i]; + } + + + cobj->setSearchPaths(vecPaths); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSearchPaths",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_runtime_setSearchPaths'.",&tolua_err); +#endif + + return 0; +} + static void register_runtime_override_function(lua_State* tolua_S) { lua_pushstring(tolua_S, "cc.FileUtils"); @@ -814,6 +869,8 @@ static void register_runtime_override_function(lua_State* tolua_S) if (lua_istable(tolua_S,-1)) { tolua_function(tolua_S,"addSearchPath",lua_cocos2dx_runtime_addSearchPath); + tolua_function(tolua_S,"setSearchPaths",lua_cocos2dx_runtime_setSearchPaths); + } lua_pop(tolua_S, 1); } diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj index facd9e9c4d..a6390f04a3 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj @@ -78,6 +78,7 @@ WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions) 4267;4251;4244;%(DisableSpecificWarnings) true + $(ProjectDir)../../../runtime/win32/$(PlatformToolsetVersion).pdb Windows @@ -85,6 +86,8 @@ true $(OutDir);%(AdditionalLibraryDirectories) libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies) + $(ProjectDir)../../../runtime/win32/$(TargetName).pdb + $(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt) 0x0409 @@ -105,21 +108,17 @@ if not exist "$(OutDir)" mkdir "$(OutDir)" -if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource\src" -mkdir "$(OutDir)\Resource\res" -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y -xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y -xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y -copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y copy files if not exist "$(OutDir)" mkdir "$(OutDir)" xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)" + + xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32\" + @@ -134,6 +133,7 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions) 4267;4251;4244;%(DisableSpecificWarnings) true + $(ProjectDir)../../../runtime/win32/$(PlatformToolsetVersion).pdb Windows @@ -141,6 +141,8 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"$(OutDir);%(AdditionalLibraryDirectories) libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies) true + $(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt) + $(ProjectDir)../../../runtime/win32/$(TargetName).pdb 0x0409 @@ -161,15 +163,8 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)" if not exist "$(OutDir)" mkdir "$(OutDir)" -if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource\src" -mkdir "$(OutDir)\Resource\res" -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y -xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y -xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y -copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y copy files diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user index 16617e63da..ceb6a746f8 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user @@ -2,9 +2,15 @@ false - $(OutDir)/Resource - $(OutDir)/Resource + $(OutDir)../../../../runtime/win32/ WindowsLocalDebugger WindowsLocalDebugger + + $(OutDir)../../../../runtime/win32/ + $(OutDir)../../../../runtime/win32/$(TargetFileName) + + + $(OutDir)../../../../runtime/win32/$(TargetFileName) + \ No newline at end of file