LLDir_Mac::LLDir_Mac() { mDirDelimiter = "/"; mCurrentDirIndex = -1; mCurrentDirCount = -1; CFBundleRef mainBundleRef = NULL; CFURLRef executableURLRef = NULL; CFStringRef stringRef = NULL; OSStatus error = noErr; FSRef fileRef; CFStringRef secondLifeString = CFSTR("SecondLife"); mainBundleRef = CFBundleGetMainBundle(); executableURLRef = CFBundleCopyExecutableURL(mainBundleRef); if (executableURLRef != NULL) { // mExecutablePathAndName CFURLRefToLLString(executableURLRef, mExecutablePathAndName, false); // mExecutableFilename stringRef = CFURLCopyLastPathComponent(executableURLRef); CFStringRefToLLString(stringRef, mExecutableFilename, true); // mExecutableDir CFURLRef executableParentURLRef = CFURLCreateCopyDeletingLastPathComponent(NULL, executableURLRef); CFURLRefToLLString(executableParentURLRef, mExecutableDir, true); // mAppRODataDir CFURLRef resourcesURLRef = CFBundleCopyResourcesDirectoryURL(mainBundleRef); CFURLRefToLLString(resourcesURLRef, mAppRODataDir, true); // mOSUserDir error = FSFindFolder(kUserDomain, kApplicationSupportFolderType, true, &fileRef); if (error == noErr) { FSRef newFileRef; // Create the directory error = CFCreateDirectory(&fileRef, secondLifeString, &newFileRef); if (error == noErr) { // Save the full path to the folder FSRefToLLString(&newFileRef, mOSUserDir); // Create our sub-dirs (void) CFCreateDirectory(&newFileRef, CFSTR("data"), NULL); //(void) CFCreateDirectory(&newFileRef, CFSTR("cache"), NULL); (void) CFCreateDirectory(&newFileRef, CFSTR("logs"), NULL); (void) CFCreateDirectory(&newFileRef, CFSTR("user_settings"), NULL); (void) CFCreateDirectory(&newFileRef, CFSTR("browser_profile"), NULL); } } //mOSCacheDir FSRef cacheDirRef; error = FSFindFolder(kUserDomain, kCachedDataFolderType, true, &cacheDirRef); if (error == noErr) { FSRefToLLString(&cacheDirRef, mOSCacheDir); (void)CFCreateDirectory(&cacheDirRef, CFSTR("SecondLife"),NULL); } // mOSUserAppDir mOSUserAppDir = mOSUserDir; // mTempDir error = FSFindFolder(kOnAppropriateDisk, kTemporaryFolderType, true, &fileRef); if (error == noErr) { FSRef tempRef; error = CFCreateDirectory(&fileRef, secondLifeString, &tempRef); if (error == noErr) FSRefToLLString(&tempRef, mTempDir); } mWorkingDir = getCurPath(); mLLPluginDir = mAppRODataDir + mDirDelimiter + "llplugin"; CFRelease(executableURLRef); executableURLRef = NULL; } }
LLDir_Mac::LLDir_Mac() { mDirDelimiter = "/"; mCurrentDirIndex = -1; mCurrentDirCount = -1; CFBundleRef mainBundleRef = NULL; CFURLRef executableURLRef = NULL; CFStringRef stringRef = NULL; OSStatus error = noErr; FSRef fileRef; CFStringRef secondLifeString = CFSTR("SecondLife"); mainBundleRef = CFBundleGetMainBundle(); executableURLRef = CFBundleCopyExecutableURL(mainBundleRef); if (executableURLRef != NULL) { // mExecutablePathAndName CFURLRefToLLString(executableURLRef, mExecutablePathAndName, false); // mExecutableFilename stringRef = CFURLCopyLastPathComponent(executableURLRef); CFStringRefToLLString(stringRef, mExecutableFilename, true); // mExecutableDir CFURLRef executableParentURLRef = CFURLCreateCopyDeletingLastPathComponent(NULL, executableURLRef); CFURLRefToLLString(executableParentURLRef, mExecutableDir, true); // mAppRODataDir // *NOTE: When running in a dev tree, use the copy of // skins in indra/newview/ rather than in the application bundle. This // mirrors Windows dev environment behavior and allows direct checkin // of edited skins/xui files. JC // MBW -- This keeps the mac application from finding other things. // If this is really for skins, it should JUST apply to skins. CFURLRef resourcesURLRef = CFBundleCopyResourcesDirectoryURL(mainBundleRef); CFURLRefToLLString(resourcesURLRef, mAppRODataDir, true); U32 indra_pos = mExecutableDir.find("/indra"); if (indra_pos != std::string::npos) { // ...we're in a dev checkout mSkinBaseDir = mExecutableDir.substr(0, indra_pos) + "/indra/newview/skins"; llinfos << "Running in dev checkout with mSkinBaseDir " << mSkinBaseDir << llendl; } else { // ...normal installation running mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; } // mOSUserDir error = FSFindFolder(kUserDomain, kApplicationSupportFolderType, true, &fileRef); if (error == noErr) { FSRef newFileRef; // Create the directory error = CFCreateDirectory(&fileRef, secondLifeString, &newFileRef); if (error == noErr) { // Save the full path to the folder FSRefToLLString(&newFileRef, mOSUserDir); // Create our sub-dirs (void) CFCreateDirectory(&newFileRef, CFSTR("data"), NULL); //(void) CFCreateDirectory(&newFileRef, CFSTR("cache"), NULL); (void) CFCreateDirectory(&newFileRef, CFSTR("logs"), NULL); (void) CFCreateDirectory(&newFileRef, CFSTR("user_settings"), NULL); (void) CFCreateDirectory(&newFileRef, CFSTR("browser_profile"), NULL); } } //mOSCacheDir FSRef cacheDirRef; error = FSFindFolder(kUserDomain, kCachedDataFolderType, true, &cacheDirRef); if (error == noErr) { FSRefToLLString(&cacheDirRef, mOSCacheDir); (void)CFCreateDirectory(&cacheDirRef, CFSTR("SecondLife"),NULL); } // mOSUserAppDir mOSUserAppDir = mOSUserDir; // mTempDir error = FSFindFolder(kOnAppropriateDisk, kTemporaryFolderType, true, &fileRef); if (error == noErr) { FSRef tempRef; error = CFCreateDirectory(&fileRef, secondLifeString, &tempRef); if (error == noErr) FSRefToLLString(&tempRef, mTempDir); } mWorkingDir = getCurPath(); mLLPluginDir = mAppRODataDir + mDirDelimiter + "llplugin"; CFRelease(executableURLRef); executableURLRef = NULL; } }