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 9ff414a691..85c7c6c858 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 @@ -1136,6 +1136,11 @@ bool initRuntime() #endif g_resourcePath = FileUtils::getInstance()->getWritablePath(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) + std::string getCurAppName(void); + g_resourcePath += getCurAppName(); + g_resourcePath +="/"; +#endif g_resourcePath += "debugruntime/"; g_resourcePath=replaceAll(g_resourcePath,"\\","/"); diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm index eeaf81e555..c6de5edcdc 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm @@ -42,7 +42,7 @@ using namespace cocos2d; bool g_landscape = false; bool g_windTop = false; cocos2d::Size g_screenSize; -GLView* g_eglView = nullptr; +GLViewImpl* g_eglView = nullptr; static AppController* g_nsAppDelegate=nullptr; @@ -58,6 +58,16 @@ std::string getCurAppPath(void) return [[[NSBundle mainBundle] bundlePath] UTF8String]; } +std::string getCurAppName(void) +{ + string appName = [[[NSProcessInfo processInfo] processName] UTF8String]; + int found = appName.find(" "); + if (found!=std::string::npos) + appName = appName.substr(0,found); + + return appName; +} + -(void) dealloc { Director::getInstance()->end(); @@ -103,7 +113,7 @@ std::string getCurAppPath(void) height = tmpvalue; } g_windTop = ConfigParser::getInstance()->isWindowTop(); - g_eglView = GLView::createWithRect([viewName cStringUsingEncoding:NSUTF8StringEncoding],cocos2d::Rect(0.0f,0.0f,width,height),frameZoomFactor); + g_eglView = GLViewImpl::createWithRect([viewName cStringUsingEncoding:NSUTF8StringEncoding],cocos2d::Rect(0.0f,0.0f,width,height),frameZoomFactor); auto director = Director::getInstance(); director->setOpenGLView(g_eglView);