| @@ -39,11 +39,11 @@ void assetInit(bool devMode) { | |||||
| CFBundleRef bundle = CFBundleGetMainBundle(); | CFBundleRef bundle = CFBundleGetMainBundle(); | ||||
| assert(bundle); | assert(bundle); | ||||
| CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(bundle); | CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(bundle); | ||||
| char buf[PATH_MAX]; | |||||
| Boolean success = CFURLGetFileSystemRepresentation(resourcesUrl, TRUE, (UInt8*) buf, sizeof(buf)); | |||||
| char resourcesBuf[PATH_MAX]; | |||||
| Boolean success = CFURLGetFileSystemRepresentation(resourcesUrl, TRUE, (UInt8*) resourcesBuf, sizeof(resourcesBuf)); | |||||
| assert(success); | assert(success); | ||||
| CFRelease(resourcesUrl); | CFRelease(resourcesUrl); | ||||
| globalDir = buf; | |||||
| globalDir = resourcesBuf; | |||||
| // Get home directory | // Get home directory | ||||
| struct passwd *pw = getpwuid(getuid()); | struct passwd *pw = getpwuid(getuid()); | ||||
| @@ -52,17 +52,17 @@ void assetInit(bool devMode) { | |||||
| localDir += "/Documents/Rack"; | localDir += "/Documents/Rack"; | ||||
| #endif | #endif | ||||
| #if ARCH_WIN | #if ARCH_WIN | ||||
| char buf[MAX_PATH]; | |||||
| DWORD length = GetModuleFileName(NULL, buf, sizeof(buf)); | |||||
| char moduleBuf[MAX_PATH]; | |||||
| DWORD length = GetModuleFileName(NULL, moduleBuf, sizeof(moduleBuf)); | |||||
| assert(length > 0); | assert(length > 0); | ||||
| PathRemoveFileSpec(buf); | |||||
| globalDir = buf; | |||||
| PathRemoveFileSpec(moduleBuf); | |||||
| globalDir = moduleBuf; | |||||
| // Get "My Documents" folder | // Get "My Documents" folder | ||||
| char buf[MAX_PATH]; | |||||
| HRESULT result = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, buf); | |||||
| char documentsBuf[MAX_PATH]; | |||||
| HRESULT result = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documentsBuf); | |||||
| assert(result == S_OK); | assert(result == S_OK); | ||||
| localDir = buf; | |||||
| localDir = documentsBuf; | |||||
| localDir += "/Rack"; | localDir += "/Rack"; | ||||
| #endif | #endif | ||||
| #if ARCH_LIN | #if ARCH_LIN | ||||
| @@ -70,13 +70,13 @@ void assetInit(bool devMode) { | |||||
| globalDir = "."; | globalDir = "."; | ||||
| // Get home directory | // Get home directory | ||||
| const char *home = getenv("HOME"); | |||||
| if (!home) { | |||||
| const char *homeBuf = getenv("HOME"); | |||||
| if (!homeBuf) { | |||||
| struct passwd *pw = getpwuid(getuid()); | struct passwd *pw = getpwuid(getuid()); | ||||
| assert(pw); | assert(pw); | ||||
| home = pw->pw_dir; | |||||
| homeBuf = pw->pw_dir; | |||||
| } | } | ||||
| localDir = home; | |||||
| localDir = homeBuf; | |||||
| localDir += "/.Rack"; | localDir += "/.Rack"; | ||||
| #endif | #endif | ||||
| } | } | ||||