void LLDir_Solaris::initAppDirs(const std::string &app_name) { mAppName = app_name; std::string upper_app_name(app_name); LLStringUtil::toUpper(upper_app_name); char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */ if (app_home_env) { // user has specified own userappdir i.e. $SECONDLIFE_USER_DIR mOSUserAppDir = app_home_env; } else { // traditionally on unixoids, MyApp gets ~/.myapp dir for data mOSUserAppDir = mOSUserDir; mOSUserAppDir += "/"; mOSUserAppDir += "."; std::string lower_app_name(app_name); LLStringUtil::toLower(lower_app_name); mOSUserAppDir += lower_app_name; } // create any directories we expect to write to. int res = LLFile::mkdir(mOSUserAppDir); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create app user dir " << mOSUserAppDir << llendl; llwarns << "Default to base dir" << mOSUserDir << llendl; mOSUserAppDir = mOSUserDir; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"")); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << llendl; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"")); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << llendl; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"")); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << llendl; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"")); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create LL_PATH_MOZILLA_PROFILE dir " << getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"") << llendl; } } mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem"); }
void LLDir_Linux::initAppDirs(const std::string &app_name, const std::string& app_read_only_data_dir) { // Allow override so test apps can read newview directory if (!app_read_only_data_dir.empty()) { mAppRODataDir = app_read_only_data_dir; mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; } mAppName = app_name; std::string upper_app_name(app_name); LLStringUtil::toUpper(upper_app_name); char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */ if (app_home_env) { // user has specified own userappdir i.e. $SECONDLIFE_USER_DIR mOSUserAppDir = app_home_env; } else { // traditionally on unixoids, MyApp gets ~/.myapp dir for data mOSUserAppDir = mOSUserDir; mOSUserAppDir += "/"; mOSUserAppDir += "."; std::string lower_app_name(app_name); LLStringUtil::toLower(lower_app_name); mOSUserAppDir += lower_app_name; } // create any directories we expect to write to. int res = LLFile::mkdir(mOSUserAppDir); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create app user dir " << mOSUserAppDir << llendl; llwarns << "Default to base dir" << mOSUserDir << llendl; mOSUserAppDir = mOSUserDir; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"")); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << llendl; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"")); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << llendl; } } res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"")); if (res == -1) { if (errno != EEXIST) { llwarns << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << llendl; } } mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem"); }