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; }