From 0e0cc7eb096ccf3426f8f503cb28b129c1a9f1a3 Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Fri, 27 Jun 2014 09:46:53 +0800 Subject: [PATCH] add ios search path --- .../runtime-src/Classes/runtime/Runtime.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 83d0ba38ba..b3893f5ae4 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 @@ -932,11 +932,14 @@ int lua_cocos2dx_runtime_addSearchPath(lua_State* tolua_S) ok &= luaval_to_std_string(tolua_S, 2,&arg0); if(!ok) return 0; - + std::string argtmp = arg0; if (!FileUtils::getInstance()->isAbsolutePath(arg0)) arg0 = g_resourcePath+arg0; - cobj->addSearchPath(arg0); +#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + if (!FileUtils::getInstance()->isAbsolutePath(argtmp)) + cobj->addSearchPath(argtmp); +#endif return 0; } CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "addSearchPath",argc, 1); @@ -983,14 +986,18 @@ int lua_cocos2dx_runtime_setSearchPaths(lua_State* tolua_S) ok &= luaval_to_std_vector_string(tolua_S, 2,&vecPaths); if(!ok) return 0; - + std::vector argtmp; for (int i = 0; i < vecPaths.size(); i++) { if (!FileUtils::getInstance()->isAbsolutePath(vecPaths[i])) + { + argtmp.push_back(vecPaths[i]); vecPaths[i] = g_resourcePath + vecPaths[i]; + } } - - +#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + vecPaths.insert(vecPaths.end(),argtmp.begin(),argtmp.end()); +#endif cobj->setSearchPaths(vecPaths); return 0; }