std::string LLDir::findSkinnedFilename(const std::string &subdir1, const std::string &subdir2, const std::string &filename) const { // generate subdirectory path fragment, e.g. "/foo/bar", "/foo", "" std::string subdirs = ((subdir1.empty() ? "" : mDirDelimiter) + subdir1) + ((subdir2.empty() ? "" : mDirDelimiter) + subdir2); std::string found_file = findFile(filename, getUserSkinDir() + subdirs, // first look in user skin override getSkinDir() + subdirs, // then in current skin getDefaultSkinDir() + subdirs); // and last in default skin return found_file; }
std::string LLDir::findSkinnedFilename(const std::string &subdir1, const std::string &subdir2, const std::string &filename) const { // generate subdirectory path fragment, e.g. "/foo/bar", "/foo", "" std::string subdirs = ((subdir1.empty() ? "" : mDirDelimiter) + subdir1) + ((subdir2.empty() ? "" : mDirDelimiter) + subdir2); std::vector<std::string> search_paths; search_paths.push_back(getUserSkinDir() + subdirs); // first look in user skin override search_paths.push_back(getSkinDir() + subdirs); // then in current skin search_paths.push_back(getDefaultSkinDir() + subdirs); // then default skin search_paths.push_back(getCacheDir() + subdirs); // and last in preload directory std::string found_file = findFile(filename, search_paths); return found_file; }
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_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_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; }
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; }