mirror of https://github.com/axmolengine/axmol.git
Merge pull request #68 from chuanweizhang2013/v3luaruntime
add mac app name in writable path
This commit is contained in:
commit
c710d9daca
|
@ -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,"\\","/");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue