diff --git a/samples/Lua/HelloLua/Classes/AppDelegate.cpp b/samples/Lua/HelloLua/Classes/AppDelegate.cpp index 1415fa33fc..56ee0a912d 100644 --- a/samples/Lua/HelloLua/Classes/AppDelegate.cpp +++ b/samples/Lua/HelloLua/Classes/AppDelegate.cpp @@ -38,17 +38,9 @@ bool AppDelegate::applicationDidFinishLaunching() CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua"); - if (pstrFileContent) - { - pEngine->executeString(pstrFileContent->getCString()); - } -#else std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua"); pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str()); pEngine->executeScriptFile(path.c_str()); -#endif return true; } diff --git a/samples/Lua/TestLua/Classes/AppDelegate.cpp b/samples/Lua/TestLua/Classes/AppDelegate.cpp index abd0e6c9cc..83aef97dbb 100644 --- a/samples/Lua/TestLua/Classes/AppDelegate.cpp +++ b/samples/Lua/TestLua/Classes/AppDelegate.cpp @@ -34,17 +34,11 @@ bool AppDelegate::applicationDidFinishLaunching() CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); std::string dirPath = "luaScript"; -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - CCString* pstrFileContent = CCString::createWithContentsOfFile((dirPath + "/controller.lua").c_str()); - if (pstrFileContent) - { - pEngine->executeString(pstrFileContent->getCString()); - } -#else + std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename((dirPath + "/controller.lua").c_str()); pEngine->addSearchPath(path.substr(0, path.find_last_of("/") - dirPath.length()).c_str()); pEngine->executeScriptFile(path.c_str()); -#endif + return true; } diff --git a/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp b/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp index fc0e1082b0..061a568c85 100644 --- a/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp +++ b/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp @@ -42,17 +42,10 @@ bool AppDelegate::applicationDidFinishLaunching() CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua"); - if (pstrFileContent) - { - pEngine->executeString(pstrFileContent->getCString()); - } -#else std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua"); pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str()); pEngine->executeScriptFile(path.c_str()); -#endif + [! else] // create a scene. it's an autorelease object CCScene *pScene = HelloWorld::scene(); diff --git a/template/multi-platform-lua/Classes/AppDelegate.cpp b/template/multi-platform-lua/Classes/AppDelegate.cpp index 55face70ca..e409a0398d 100644 --- a/template/multi-platform-lua/Classes/AppDelegate.cpp +++ b/template/multi-platform-lua/Classes/AppDelegate.cpp @@ -33,17 +33,9 @@ bool AppDelegate::applicationDidFinishLaunching() CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua"); - if (pstrFileContent) - { - pEngine->executeString(pstrFileContent->getCString()); - } -#else std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua"); pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str()); pEngine->executeScriptFile(path.c_str()); -#endif return true; } diff --git a/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp b/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp index a4690fe0c6..8a79c8abfa 100644 --- a/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp +++ b/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp @@ -36,17 +36,9 @@ bool AppDelegate::applicationDidFinishLaunching() CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua"); - if (pstrFileContent) - { - pEngine->executeString(pstrFileContent->getCString()); - } -#else std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua"); pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str()); pEngine->executeScriptFile(path.c_str()); -#endif return true; } diff --git a/tools/lua_project_generator/template/Classes/AppDelegate.cpp b/tools/lua_project_generator/template/Classes/AppDelegate.cpp index 1402bbd55a..0e7aea8075 100644 --- a/tools/lua_project_generator/template/Classes/AppDelegate.cpp +++ b/tools/lua_project_generator/template/Classes/AppDelegate.cpp @@ -37,17 +37,9 @@ bool AppDelegate::applicationDidFinishLaunching() CCScriptEngineProtocol* pEngine = CCLuaEngine::engine(); CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua"); - if (pstrFileContent) - { - pEngine->executeString(pstrFileContent->getCString()); - } -#else std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua"); pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str()); pEngine->executeScriptFile(path.c_str()); -#endif return true; }