EXT-4470 Several bad assumptions that LL_PATH_PER_SL_ACCOUNT is always good (which it isn't until after login)
To be reviewed by Soft!master
parent
48123c536c
commit
66f5f2b922
|
|
@ -200,6 +200,11 @@ const std::string &LLDir::getOSUserAppDir() const
|
|||
|
||||
const std::string &LLDir::getLindenUserDir() const
|
||||
{
|
||||
if (mLindenUserDir.empty())
|
||||
{
|
||||
lldebugs << "getLindenUserDir() called early, we don't have the user name yet - returning empty string to caller" << llendl;
|
||||
}
|
||||
|
||||
return mLindenUserDir;
|
||||
}
|
||||
|
||||
|
|
@ -337,7 +342,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
|
|||
break;
|
||||
|
||||
case LL_PATH_CACHE:
|
||||
prefix = getCacheDir();
|
||||
prefix = getCacheDir();
|
||||
break;
|
||||
|
||||
case LL_PATH_USER_SETTINGS:
|
||||
|
|
@ -348,6 +353,11 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
|
|||
|
||||
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:
|
||||
|
|
@ -557,7 +567,7 @@ std::string LLDir::getForbiddenFileChars()
|
|||
|
||||
void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
|
||||
{
|
||||
// if both first and last aren't set, assume we're grabbing the cached dir
|
||||
// if both first and last aren't set, that's bad.
|
||||
if (!first.empty() && !last.empty())
|
||||
{
|
||||
// some platforms have case-sensitive filesystems, so be
|
||||
|
|
@ -571,6 +581,7 @@ void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
|
|||
mLindenUserDir += firstlower;
|
||||
mLindenUserDir += "_";
|
||||
mLindenUserDir += lastlower;
|
||||
llinfos << "Got name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ typedef enum ELLPath
|
|||
LL_PATH_NONE = 0,
|
||||
LL_PATH_USER_SETTINGS = 1,
|
||||
LL_PATH_APP_SETTINGS = 2,
|
||||
LL_PATH_PER_SL_ACCOUNT = 3,
|
||||
LL_PATH_PER_SL_ACCOUNT = 3, // returns/expands to blank string if we don't know the account name yet
|
||||
LL_PATH_CACHE = 4,
|
||||
LL_PATH_CHARACTER = 5,
|
||||
LL_PATH_HELP = 6,
|
||||
|
|
|
|||
|
|
@ -112,9 +112,10 @@ LLDir_Linux::LLDir_Linux()
|
|||
// ...normal installation running
|
||||
mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins";
|
||||
}
|
||||
|
||||
mOSUserDir = getCurrentUserHome(tmp_str);
|
||||
mOSUserAppDir = "";
|
||||
mLindenUserDir = tmp_str;
|
||||
mLindenUserDir = "";
|
||||
|
||||
char path [32]; /* Flawfinder: ignore */
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ LLDir_Solaris::LLDir_Solaris()
|
|||
mAppRODataDir = strdup(tmp_str);
|
||||
mOSUserDir = getCurrentUserHome(tmp_str);
|
||||
mOSUserAppDir = "";
|
||||
mLindenUserDir = tmp_str;
|
||||
mLindenUserDir = "";
|
||||
|
||||
char path [LL_MAX_PATH]; /* Flawfinder: ignore */
|
||||
|
||||
|
|
|
|||
|
|
@ -1480,8 +1480,15 @@ bool LLAppViewer::cleanup()
|
|||
|
||||
// PerAccountSettingsFile should be empty if no use has been logged on.
|
||||
// *FIX:Mani This should get really saved in a "logoff" mode.
|
||||
gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
|
||||
llinfos << "Saved settings" << llendflush;
|
||||
if (gSavedSettings.getString("PerAccountSettingsFile").empty())
|
||||
{
|
||||
llinfos << "Not saving per-account settings; don't know the account name yet." << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
|
||||
llinfos << "Saved settings" << llendflush;
|
||||
}
|
||||
|
||||
std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE);
|
||||
// save all settings, even if equals defaults
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ void LLAvatarIconIDCache::load ()
|
|||
llinfos << "Loading avatar icon id cache." << llendl;
|
||||
|
||||
// build filename for each user
|
||||
std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
|
||||
std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
|
||||
llifstream file(resolved_filename);
|
||||
|
||||
if (!file.is_open())
|
||||
|
|
@ -97,7 +97,7 @@ void LLAvatarIconIDCache::load ()
|
|||
|
||||
void LLAvatarIconIDCache::save ()
|
||||
{
|
||||
std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
|
||||
std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
|
||||
|
||||
// open a file for writing
|
||||
llofstream file (resolved_filename);
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ void LLLocationHistory::save() const
|
|||
// build filename for each user
|
||||
std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
|
||||
|
||||
if (resolved_filename.empty())
|
||||
{
|
||||
llinfos << "can't get path to location history filename - probably not logged in yet." << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
// open a file for writing
|
||||
llofstream file (resolved_filename);
|
||||
if (!file.is_open())
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ LLMuteList::~LLMuteList()
|
|||
{
|
||||
// If we quit from the login screen we will not have an SL account
|
||||
// name. Don't try to save, otherwise we'll dump a file in
|
||||
// C:\Program Files\SecondLife\ JC
|
||||
// C:\Program Files\SecondLife\ or similar. JC
|
||||
std::string user_dir = gDirUtilp->getLindenUserDir();
|
||||
if (!user_dir.empty())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
#include "llviewermenu.h"
|
||||
#include "llviewertexturelist.h"
|
||||
|
||||
const std::string FILTERS_FILENAME("filters.xml");
|
||||
|
||||
static LLRegisterPanelClassWrapper<LLPanelMainInventory> t_inventory("panel_main_inventory");
|
||||
|
||||
void on_file_loaded_for_save(BOOL success,
|
||||
|
|
@ -160,7 +162,7 @@ BOOL LLPanelMainInventory::postBuild()
|
|||
|
||||
// Now load the stored settings from disk, if available.
|
||||
std::ostringstream filterSaveName;
|
||||
filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml");
|
||||
filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
|
||||
llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName << llendl;
|
||||
llifstream file(filterSaveName.str());
|
||||
LLSD savedFilterState;
|
||||
|
|
@ -230,7 +232,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
|
|||
}
|
||||
|
||||
std::ostringstream filterSaveName;
|
||||
filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml");
|
||||
filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
|
||||
llofstream filtersFile(filterSaveName.str());
|
||||
if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -920,9 +920,9 @@ bool idle_startup()
|
|||
// create necessary directories
|
||||
// *FIX: these mkdir's should error check
|
||||
gDirUtilp->setLindenUserDir(gFirstname, gLastname);
|
||||
LLFile::mkdir(gDirUtilp->getLindenUserDir());
|
||||
|
||||
// Set PerAccountSettingsFile to the default value.
|
||||
LLFile::mkdir(gDirUtilp->getLindenUserDir());
|
||||
|
||||
// Set PerAccountSettingsFile to the default value.
|
||||
gSavedSettings.setString("PerAccountSettingsFile",
|
||||
gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
|
||||
LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")));
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ bool LLURLHistory::saveFile(const std::string& filename)
|
|||
std::string temp_str = gDirUtilp->getLindenUserDir();
|
||||
if( temp_str.empty() )
|
||||
{
|
||||
llwarns << "Can't save. No user directory set." << llendl;
|
||||
llinfos << "Can't save URL history - no user directory set yet." << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,12 @@ bool LLUrlWhiteList::save ()
|
|||
// build filename for each user
|
||||
std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename );
|
||||
|
||||
if (resolvedFilename.empty())
|
||||
{
|
||||
llinfos << "No per-user dir for saving URL whitelist - presumably not logged in yet. Skipping." << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// open a file for writing
|
||||
llofstream file ( resolvedFilename );
|
||||
if ( file.is_open () )
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ static std::string get_texture_list_name()
|
|||
|
||||
void LLViewerTextureList::doPrefetchImages()
|
||||
{
|
||||
if (LLAppViewer::instance()->getPurgeCache())
|
||||
if (LLAppViewer::instance()->getPurgeCache())
|
||||
{
|
||||
// cache was purged, no point
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue