diff options
author | brad kittenbrink <brad@lindenlab.com> | 2011-02-17 16:20:58 -0800 |
---|---|---|
committer | brad kittenbrink <brad@lindenlab.com> | 2011-02-17 16:20:58 -0800 |
commit | 83a42e91d43c1d9c1b57fc664ce3d6171205e751 (patch) | |
tree | ce1800a863077c7d685bd19fd504e61070898dc0 /indra | |
parent | 49e28d324066add8cca44e27806b8077d3b0c542 (diff) |
Ported over mani's patch for handling finding of the RO appdata dir when running from the debugger.
ported from changeset https://hg.lindenlab.com/alain/indra-common/changeset/99a9d1876e83/
reviewed by Richard.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llvfs/lldir_win32.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index b9a3995e25..4e2a55f4b3 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -81,10 +81,11 @@ LLDir_Win32::LLDir_Win32() // fprintf(stderr, "mTempDir = <%s>",mTempDir); -#if 1 - // Don't use the real app path for now, as we'll have to add parsing to detect if - // we're in a developer tree, which has a different structure from the installed product. + // Set working directory, for LLDir::getWorkingDir() + GetCurrentDirectory(MAX_PATH, w_str); + mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); + // Set the executable directory S32 size = GetModuleFileName(NULL, w_str, MAX_PATH); if (size) { @@ -100,32 +101,35 @@ LLDir_Win32::LLDir_Win32() { mExecutableFilename = mExecutablePathAndName; } - GetCurrentDirectory(MAX_PATH, w_str); - mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); } else { fprintf(stderr, "Couldn't get APP path, assuming current directory!"); - GetCurrentDirectory(MAX_PATH, w_str); - mExecutableDir = utf16str_to_utf8str(llutf16string(w_str)); + mExecutableDir = mWorkingDir; // Assume it's the current directory } -#else - GetCurrentDirectory(MAX_PATH, w_str); - mExecutableDir = utf16str_to_utf8str(llutf16string(w_str)); -#endif - if (mExecutableDir.find("indra") == std::string::npos) + // mAppRODataDir = "."; + + // Determine the location of the App-Read-Only-Data + // Try the working directory then the exe's dir. + mAppRODataDir = mWorkingDir; + + +// if (mExecutableDir.find("indra") == std::string::npos) + + // *NOTE:Mani - It is a mistake to put viewer specific code in + // the LLDir implementation. The references to 'skins' and + // 'llplugin' need to go somewhere else. + // alas... this also gets called during static initialization + // time due to the construction of gDirUtil in lldir.cpp. + if(! LLFile::isdir(mAppRODataDir + mDirDelimiter + "skins")) { - // Running from installed directory. Make sure current - // directory isn't something crazy (e.g. if invoking from - // command line). - SetCurrentDirectory(utf8str_to_utf16str(mExecutableDir).c_str()); - GetCurrentDirectory(MAX_PATH, w_str); - mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); + // What? No skins in the working dir? + // Try the executable's directory. + mAppRODataDir = mExecutableDir; } - mAppRODataDir = mWorkingDir; llinfos << "mAppRODataDir = " << mAppRODataDir << llendl; |