const std::string LLDir::getCacheDir(bool get_default) const { if (mCacheDir.empty() || get_default) { std::string res; if (getOSCacheDir().empty()) { if (getOSUserAppDir().empty()) { res = "data"; } else { res = getOSUserAppDir() + mDirDelimiter + "cache"; } } else { res = getOSCacheDir() + mDirDelimiter + "Imprudence"; } return res; } else { return mCacheDir; } }
void LLDir::setLindenUserDir(const std::string &grid, const std::string &first, const std::string &last) { // if both first and last aren't set, assume we're grabbing the cached dir if (!first.empty() && !last.empty()) { // some platforms have case-sensitive filesystems, so be // utterly consistent with our firstname/lastname case. std::string firstlower(first); LLStringUtil::toLower(firstlower); std::string lastlower(last); LLStringUtil::toLower(lastlower); mLindenUserDir = getOSUserAppDir(); mLindenUserDir += mDirDelimiter; mLindenUserDir += firstlower; mLindenUserDir += "_"; mLindenUserDir += lastlower; if (!grid.empty()) { std::string gridlower(grid); LLStringUtil::toLower(gridlower); mLindenUserDir += "@"; mLindenUserDir += gridlower; } } else { llerrs << "Invalid name for LLDir::setLindenUserDir" << llendl; } dumpCurrentDirectories(); }
void LLDir::setLindenUserDir(const std::string &username, const std::string &gridnick) { // if the username isn't set, that's bad if (!username.empty()) { // some platforms have case-sensitive filesystems, so be // utterly consistent with our firstname/lastname case. std::string userlower(username); LLStringUtil::toLower(userlower); LLStringUtil::replaceChar(userlower, ' ', '_'); mLindenUserDir = getOSUserAppDir(); mLindenUserDir += mDirDelimiter; mLindenUserDir += userlower; if(gridnick != "agni" && gridnick != "aditi") { mLindenUserDir += "_"; mLindenUserDir += gridnick; } } else { llerrs << "NULL name for LLDir::setLindenUserDir" << llendl; } dumpCurrentDirectories(); }
// Return the default cache directory std::string LLDir::buildSLOSCacheDir() const { std::string res; if (getOSCacheDir().empty()) { if (getOSUserAppDir().empty()) { res = "data"; } else { res = getOSUserAppDir() + mDirDelimiter + "cache"; } } else { res = getOSCacheDir() + mDirDelimiter + "Kirstens S19"; // KL } return res; }
// Return the default cache directory std::string LLDir::buildSLOSCacheDir() const { std::string res; if (getOSCacheDir().empty()) { if (getOSUserAppDir().empty()) { res = "data"; } else { res = getOSUserAppDir() + mDirDelimiter + "cache_sg1"; } } else { res = getOSCacheDir() + mDirDelimiter + "PartyHat"; } return res; }
// Return the default cache directory std::string LLDir::buildSLOSCacheDir() const { std::string res; if (getOSCacheDir().empty()) { if (getOSUserAppDir().empty()) { res = "data"; } else { res = getOSUserAppDir() + mDirDelimiter + "phoenixviewer"; } } else { res = getOSCacheDir() + mDirDelimiter + "PhoenixViewer"; } return res; }
void LLDir::dumpCurrentDirectories() { LL_DEBUGS2("AppInit","Directories") << "Current Directories:" << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " CurPath: " << getCurPath() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " AppName: " << getAppName() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " ExecutableFilename: " << getExecutableFilename() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " ExecutableDir: " << getExecutableDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " WorkingDir: " << getWorkingDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " AppRODataDir: " << getAppRODataDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " OSUserDir: " << getOSUserDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " OSUserAppDir: " << getOSUserAppDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " LindenUserDir: " << getLindenUserDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " TempDir: " << getTempDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " CAFile: " << getCAFile() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " SkinDir: " << getSkinDir() << LL_ENDL; }
void LLDir::setSkinFolder(const std::string &skin_folder) { mSkinDir = getSkinBaseDir(); mSkinDir += mDirDelimiter; mSkinDir += skin_folder; // user modifications to current skin // e.g. c:\documents and settings\users\username\application data\second life\skins\dazzle mUserSkinDir = getOSUserAppDir(); mUserSkinDir += mDirDelimiter; mUserSkinDir += "skins_sg1"; mUserSkinDir += mDirDelimiter; mUserSkinDir += skin_folder; // base skin which is used as fallback for all skinned files // e.g. c:\program files\secondlife\skins\default mDefaultSkinDir = getSkinBaseDir(); mDefaultSkinDir += mDirDelimiter; mDefaultSkinDir += "default"; }
void LLDir::dumpCurrentDirectories() { LL_DEBUGS2("AppInit","Directories") << "Current Directories:" << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " CurPath: " << getCurPath() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " AppName: " << getAppName() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " ExecutableFilename: " << getExecutableFilename() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " ExecutableDir: " << getExecutableDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " WorkingDir: " << getWorkingDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " AppRODataDir: " << getAppRODataDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " OSUserDir: " << getOSUserDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " OSUserAppDir: " << getOSUserAppDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " LindenUserDir: " << getLindenUserDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " TempDir: " << getTempDir() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " CAFile: " << getCAFile() << LL_ENDL; LL_DEBUGS2("AppInit","Directories") << " SkinDir: " << getSkinDir() << LL_ENDL; #if LL_LIBXUL_ENABLED LL_DEBUGS2("AppInit","Directories") << " HTML Path: " << getExpandedFilename( LL_PATH_HTML, "" ) << llendl; LL_DEBUGS2("AppInit","Directories") << " Mozilla Profile Path: " << getExpandedFilename( LL_PATH_MOZILLA_PROFILE, "" ) << llendl; #endif }
std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subdir1, const std::string& subdir2, const std::string& in_filename) const { std::string prefix; switch (location) { case LL_PATH_NONE: // Do nothing break; case LL_PATH_APP_SETTINGS: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "app_settings"; break; case LL_PATH_CHARACTER: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "character"; break; case LL_PATH_MOTIONS: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "motions"; break; case LL_PATH_HELP: prefix = "help"; break; case LL_PATH_CACHE: prefix = getCacheDir(); break; case LL_PATH_USER_SETTINGS: prefix = getOSUserAppDir(); prefix += mDirDelimiter; prefix += "user_settings"; break; case LL_PATH_PER_SL_ACCOUNT: prefix = getLindenUserDir(); break; case LL_PATH_CHAT_LOGS: prefix = getChatLogsDir(); break; case LL_PATH_PER_ACCOUNT_CHAT_LOGS: prefix = getPerAccountChatLogsDir(); break; case LL_PATH_LOGS: prefix = getOSUserAppDir(); prefix += mDirDelimiter; prefix += "logs"; break; case LL_PATH_TEMP: prefix = getTempDir(); break; case LL_PATH_TOP_SKIN: prefix = getSkinDir(); break; case LL_PATH_SKINS: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "skins"; break; //case LL_PATH_HTML: // prefix = getSkinDir(); // prefix += mDirDelimiter; // prefix += "html"; // break; case LL_PATH_MOZILLA_PROFILE: prefix = getOSUserAppDir(); prefix += mDirDelimiter; prefix += "browser_profile"; break; case LL_PATH_EXECUTABLE: prefix = getExecutableDir(); break; default: llassert(0); } std::string filename = in_filename; if (!subdir2.empty()) { filename = subdir2 + mDirDelimiter + filename; } if (!subdir1.empty()) { filename = subdir1 + mDirDelimiter + filename; } std::string expanded_filename; if (!filename.empty()) { if (!prefix.empty()) { expanded_filename += prefix; expanded_filename += mDirDelimiter; expanded_filename += filename; } else { expanded_filename = filename; } } else if (!prefix.empty()) { // Directory only, no file name. expanded_filename = prefix; } else { expanded_filename.assign(""); } //llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl; return expanded_filename; }
std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subdir1, const std::string& subdir2, const std::string& in_filename) const { std::string prefix; switch (location) { case LL_PATH_NONE: // Do nothing break; case LL_PATH_APP_SETTINGS: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "app_settings"; break; case LL_PATH_CHARACTER: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "character"; break; case LL_PATH_FS_RESOURCES: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "fs_resources"; break; case LL_PATH_HELP: prefix = "help"; break; case LL_PATH_CACHE: prefix = getCacheDir(); break; case LL_PATH_USER_SETTINGS: prefix = getOSUserAppDir(); prefix += mDirDelimiter; prefix += "user_settings"; break; case LL_PATH_PER_SL_ACCOUNT: prefix = getLindenUserDir(); if (prefix.empty()) { // if we're asking for the per-SL-account directory but we haven't logged in yet (or otherwise don't know the account name from which to build this string), then intentionally return a blank string to the caller and skip the below warning about a blank prefix. return std::string(); } break; case LL_PATH_CHAT_LOGS: prefix = getChatLogsDir(); break; case LL_PATH_PER_ACCOUNT_CHAT_LOGS: prefix = getPerAccountChatLogsDir(); break; case LL_PATH_LOGS: prefix = getOSUserAppDir(); prefix += mDirDelimiter; prefix += "logs"; break; case LL_PATH_TEMP: prefix = getTempDir(); break; case LL_PATH_TOP_SKIN: prefix = getSkinDir(); break; // [SL:KB] - Catznip Viewer-Skins case LL_PATH_TOP_SKINTHEME: prefix = getSkinThemeDir(); break; case LL_PATH_DEFAULT_SKIN: prefix = getDefaultSkinDir(); break; case LL_PATH_USER_SKIN: prefix = getUserSkinDir(); break; case LL_PATH_SKINS: prefix = getSkinBaseDir(); break; case LL_PATH_LOCAL_ASSETS: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "local_assets"; break; case LL_PATH_EXECUTABLE: prefix = getExecutableDir(); break; case LL_PATH_FONTS: prefix = getAppRODataDir(); prefix += mDirDelimiter; prefix += "fonts"; break; default: llassert(0); } std::string filename = in_filename; if (!subdir2.empty()) { filename = subdir2 + mDirDelimiter + filename; } if (!subdir1.empty()) { filename = subdir1 + mDirDelimiter + filename; } if (prefix.empty()) { llwarns << "prefix is empty, possible bad filename" << llendl; } std::string expanded_filename; if (!filename.empty()) { if (!prefix.empty()) { expanded_filename += prefix; expanded_filename += mDirDelimiter; expanded_filename += filename; } else { expanded_filename = filename; } } else if (!prefix.empty()) { // Directory only, no file name. expanded_filename = prefix; } else { expanded_filename.assign(""); } //llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl; return expanded_filename; }