summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llvfs/lldir.cpp15
-rw-r--r--indra/llvfs/lldir.h2
-rw-r--r--indra/llvfs/lldir_linux.cpp3
-rw-r--r--indra/llvfs/lldir_solaris.cpp2
-rw-r--r--indra/newview/llappviewer.cpp11
-rw-r--r--indra/newview/llavatariconctrl.cpp4
-rw-r--r--indra/newview/lllocationhistory.cpp6
-rw-r--r--indra/newview/llmutelist.cpp2
-rw-r--r--indra/newview/llpanelmaininventory.cpp6
-rw-r--r--indra/newview/llstartup.cpp6
-rw-r--r--indra/newview/llurlhistory.cpp2
-rw-r--r--indra/newview/llurlwhitelist.cpp6
-rw-r--r--indra/newview/llviewertexturelist.cpp2
13 files changed, 50 insertions, 17 deletions
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index b2b17fdd56..da4abde451 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -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
{
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 206e3223e3..9067d75bac 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -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,
diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp
index ee902d1de7..a9736560ec 100644
--- a/indra/llvfs/lldir_linux.cpp
+++ b/indra/llvfs/lldir_linux.cpp
@@ -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 */
diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp
index a8fad8e5bd..8ac5a41e93 100644
--- a/indra/llvfs/lldir_solaris.cpp
+++ b/indra/llvfs/lldir_solaris.cpp
@@ -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 */
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 4a61096ad8..704198aff5 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -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
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index 42ae122ff9..87b8d807c4 100644
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -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);
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp
index d910dbf718..ae1b8f8540 100644
--- a/indra/newview/lllocationhistory.cpp
+++ b/indra/newview/lllocationhistory.cpp
@@ -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())
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp
index b520bc1c2d..af66b6e3de 100644
--- a/indra/newview/llmutelist.cpp
+++ b/indra/newview/llmutelist.cpp
@@ -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())
{
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index e74a39c85c..a5a61f0c7b 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -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))
{
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index fbc98b7691..ad88534a5d 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -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")));
diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp
index e8b5aa7c74..08dd82ab86 100644
--- a/indra/newview/llurlhistory.cpp
+++ b/indra/newview/llurlhistory.cpp
@@ -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;
}
diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp
index da69039cf9..46bc9276c1 100644
--- a/indra/newview/llurlwhitelist.cpp
+++ b/indra/newview/llurlwhitelist.cpp
@@ -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 () )
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 8252b7df00..6bb547373c 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -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;