From f2b39196a0fd77b4f1f9ddd2b1839d7abfbcb2f1 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 26 Mar 2019 02:23:51 -0400 Subject: [PATCH] In dev checkouts, AppViewer now sets AppRoDataDir to newview Crossplatform, settings, windlights, skins, the works~ No more copying~ <3 --- indra/llvfs/lldir_linux.cpp | 17 +---------------- indra/llvfs/lldir_mac.cpp | 17 ++--------------- indra/llvfs/lldir_win32.cpp | 13 +------------ indra/newview/llappviewer.cpp | 18 ++++++++++++++++-- 4 files changed, 20 insertions(+), 45 deletions(-) diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index b98ff7768..c1ae9eae1 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -93,22 +93,7 @@ LLDir_Linux::LLDir_Linux() #else mAppRODataDir = tmp_str; #endif - std::string::size_type build_dir_pos = mExecutableDir.rfind("/build-linux-"); - if (build_dir_pos != std::string::npos) - { - // ...we're in a dev checkout - mSkinBaseDir = mExecutableDir.substr(0, build_dir_pos) + "/indra/newview/skins"; - if (LLFile::isdir(mSkinBaseDir)) - LL_INFOS() << "Running in dev checkout with mSkinBaseDir " - << mSkinBaseDir << LL_ENDL; - else - mSkinBaseDir.clear(); - } - if (mSkinBaseDir.empty()) - { - // ...normal installation running - mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; - } + mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; mOSUserDir = getCurrentUserHome(tmp_str); mOSUserAppDir = ""; diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 29ab1a5c9..1127614aa 100644 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -149,21 +149,8 @@ LLDir_Mac::LLDir_Mac() CFURLRef resourcesURLRef = CFBundleCopyResourcesDirectoryURL(mainBundleRef); CFURLRefToLLString(resourcesURLRef, mAppRODataDir, true); - - size_t build_dir_pos = mExecutableDir.rfind("/indra/build-darwin-"); - if (build_dir_pos != std::string::npos) - { - // ...we're in a dev checkout - mSkinBaseDir = mExecutableDir.substr(0, build_dir_pos) - + "/indra/newview/skins"; - LL_INFOS() << "Running in dev checkout with mSkinBaseDir " - << mSkinBaseDir << LL_ENDL; - } - else - { - // ...normal installation running - mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; - } + + mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; // mOSUserDir error = FSFindFolder(kUserDomain, kApplicationSupportFolderType, true, &fileRef); diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index 9f89641a3..8547f1408 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -140,18 +140,7 @@ LLDir_Win32::LLDir_Win32() // LL_INFOS() << "mAppRODataDir = " << mAppRODataDir << LL_ENDL; - auto build_dir_pos = mExecutableDir.rfind("build-"); - if (build_dir_pos != std::string::npos) - { - // ...we're in a dev checkout - mSkinBaseDir = mExecutableDir.substr(0, build_dir_pos) + "indra" + mDirDelimiter + "newview" + mDirDelimiter + "skins"; - if (LLFile::isdir(mSkinBaseDir)) - LL_INFOS() << "Running in dev checkout with mSkinBaseDir " << mSkinBaseDir << LL_ENDL; - else mSkinBaseDir.clear(); - } - - if (mSkinBaseDir.empty()) // ...normal installation running - mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; + mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; // Build the default cache directory mDefaultCacheDir = buildSLOSCacheDir(); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 13c769e7e..5c0c5f14c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -566,11 +566,25 @@ LLAppViewer::LLAppViewer() : LL_ERRS() << "Oh no! An instance of LLAppViewer already exists! LLAppViewer is sort of like a singleton." << LL_ENDL; } - mDumpPath =""; + mDumpPath.clear(); // Need to do this initialization before we do anything else, since anything // that touches files should really go through the lldir API - gDirUtilp->initAppDirs("SecondLife"); + { + std::string newview_path; + const auto& exe_dir = gDirUtilp->getExecutableDir(); + auto build_dir_pos = exe_dir.rfind("build-"); + if (build_dir_pos != std::string::npos) + { + // ...we're in a dev checkout + newview_path = gDirUtilp->add(gDirUtilp->add(exe_dir.substr(0, build_dir_pos), "indra"), "newview"); + if (LLFile::isdir(newview_path)) + LL_INFOS() << "Running in dev checkout with newview " << newview_path << LL_ENDL; + else newview_path.clear(); + } + + gDirUtilp->initAppDirs("SecondLife", newview_path); + } sInstance = this; }