summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2017-12-20 22:51:26 -0500
committerNat Goodspeed <nat@lindenlab.com>2017-12-20 22:51:26 -0500
commit5002bf5660f41685fc0549880994f4b35440d535 (patch)
tree9eee598eb855757a9d6909408f0d04101b83c8ab /indra/newview
parent36e5f543ced86ce1d976c0740fe04bc36475fbaf (diff)
MAINT-8087: Use env vars from VMP for AppData\Roaming and Local.
On Windows, when logged in with a non-ASCII username, every one of the three documented APIs -- SHGetSpecialFolderPath(), SHGetFolderPath() and SHGetKnownFolderPath() -- fails to retrieve any pathname at all. We cannot account for the fact that the oldest of these continues to work with the release viewer and within a Python script (though not, curiously, from a Python interactive session). With a non-ASCII username, they consistently fail when called from an Alex Ivy viewer build: "The filename, directory name, or volume label syntax is incorrect." Empirically, with a non-ASCII username, the preset APPDATA and LOCALAPPDATA environment variables are also useless, e.g. c:\Users\??????\AppData\Roaming where those are, yup, actual question marks. Empirically, the VMP is able to successfully call SHGetFolderPath() to retrieve both AppData\Roaming and AppData\Local. Therefore, we make the VMP set the APPDATA and LOCALAPPDATA environment variables to the UTF-8 encoded correct pathnames. Instead of calling SHGetSomethingFolderPath() at all, make LLDir_Win32 retrieve those environment variables. Make LLFile::mkdir() treat "directory already exists" as a success case. Every single call fell into one of two categories: either it didn't check success at all, or it tested specially to exempt errno == EEXIST. Migrate that test into mkdir(); eliminate it from call sites. Make LLDir::append() and add() convenience functions accept variadic arguments. Replace add(add()...) constructs, as well as clumsy concatenations of directory names and getDirDelimiter(), with simple variadic add() calls.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp10
-rw-r--r--indra/newview/llpresetsmanager.cpp10
-rw-r--r--indra/newview/lltexturecache.cpp8
3 files changed, 8 insertions, 20 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 087a672d69..b33b3a6410 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4136,10 +4136,7 @@ void dumpVFSCaches()
S32 res = LLFile::mkdir("StaticVFSDump");
if (res == -1)
{
- if (errno != EEXIST)
- {
- LL_WARNS() << "Couldn't create dir StaticVFSDump" << LL_ENDL;
- }
+ LL_WARNS() << "Couldn't create dir StaticVFSDump" << LL_ENDL;
}
SetCurrentDirectory(utf8str_to_utf16str("StaticVFSDump").c_str());
gStaticVFS->dumpFiles();
@@ -4153,10 +4150,7 @@ void dumpVFSCaches()
res = LLFile::mkdir("VFSDump");
if (res == -1)
{
- if (errno != EEXIST)
- {
- LL_WARNS() << "Couldn't create dir VFSDump" << LL_ENDL;
- }
+ LL_WARNS() << "Couldn't create dir VFSDump" << LL_ENDL;
}
SetCurrentDirectory(utf8str_to_utf16str("VFSDump").c_str());
gVFS->dumpFiles();
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index 76d721ecdc..96818d5a21 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -78,16 +78,10 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory)
std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR);
std::string full_path;
- if (!gDirUtilp->fileExists(presets_path))
- {
- LLFile::mkdir(presets_path);
- }
+ LLFile::mkdir(presets_path);
full_path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PRESETS_DIR, subdirectory);
- if (!gDirUtilp->fileExists(full_path))
- {
- LLFile::mkdir(full_path);
- }
+ LLFile::mkdir(full_path);
return full_path;
}
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 435d833345..371da5d0a2 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1054,11 +1054,11 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache
return max_size ;
}
}
-
+
if (!mReadOnly)
{
LLFile::mkdir(mTexturesDirName);
-
+
const char* subdirs = "0123456789abcdef";
for (S32 i=0; i<16; i++)
{
@@ -1602,11 +1602,11 @@ void LLTextureCache::clearCorruptedCache()
closeHeaderEntriesFile();//close possible file handler
purgeAllTextures(false) ; //clear the cache.
-
+
if (!mReadOnly) //regenerate the directory tree if not exists.
{
LLFile::mkdir(mTexturesDirName);
-
+
const char* subdirs = "0123456789abcdef";
for (S32 i=0; i<16; i++)
{