diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2018-12-06 14:33:51 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2018-12-06 14:33:51 -0500 |
commit | 758e7e8df753a9b63782ff2964c26c0b0a4015fe (patch) | |
tree | 0f41b50220f39da6804d30ef33c30485c1b58ff5 /indra/llvfs | |
parent | 1029f6b776fbef66959ef621f233cf1012b3f72b (diff) |
SL-10174: LOCALAPPDATA bad? Try SHGetFolderPath(CSIDL_LOCAL_APPDATA).
This logic is essentially copy-and-edited from the same suspenders-and-belt
concerning APPDATA and CSIDL_APPDATA for SL-10153.
Diffstat (limited to 'indra/llvfs')
-rw-r--r-- | indra/llvfs/lldir_win32.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index 3e48e086d7..f972f27fd0 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -90,6 +90,19 @@ LLDir_Win32::LLDir_Win32() // We used to store the cache in AppData\Roaming, and the installer // cleans up that version on upgrade. JC mOSCacheDir = ll_safe_string(getenv("LOCALAPPDATA")); + // Windows really does not deal well with pathnames containing non-ASCII + // characters. See above remarks about APPDATA. + if (utf8string_to_wstring(mOSCacheDir).find(llwchar('?')) != LLWString::npos) + { + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, w_str))) + { + // But of course, only update mOSCacheDir if SHGetFolderPathW() works. + mOSCacheDir = utf16str_to_utf8str(llutf16string(w_str)); + // Update our environment so that child processes will see a + // reasonable value as well. + _putenv_s("LOCALAPPDATA", mOSCacheDir.c_str()); + } + } if (GetTempPath(MAX_PATH, w_str)) { |