From 6b84bfac15db4e887dc0ebcb97aede4f000e1e3c Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Wed, 20 Jan 2016 10:09:23 -0500 Subject: [PATCH] Add a mechanism with which to determine viewer channel in the case of no commandline option --- indra/newview/llappviewer.cpp | 27 +++++++++++++++++++++++++++ indra/newview/llversioninfo.cpp | 5 +++++ indra/newview/llversioninfo.h | 1 + 3 files changed, 33 insertions(+) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a0ae18270..9ab4cabef 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2262,6 +2262,33 @@ bool LLAppViewer::initConfiguration() LL_INFOS() << "Using command line specified settings filename: " << user_settings_filename << LL_ENDL; } + else + { + std::string channel(LLVersionInfo::getChannel()); + LLStringUtil::toLower(channel); + switch (LLVersionInfo::getViewerMaturity()) + { + default: + case LLVersionInfo::TEST_VIEWER: + case LLVersionInfo::PROJECT_VIEWER: + case LLVersionInfo::ALPHA_VIEWER: + case LLVersionInfo::BETA_VIEWER: + { + channel.erase(std::remove_if(channel.begin(), channel.end(), isspace), channel.end()); + break; + } + case LLVersionInfo::RELEASE_VIEWER: + size_t pos = channel.find(' '); + if (pos != channel.npos) + channel.erase(pos, channel.npos); + break; + } + std::string settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, + llformat("settings_%s.xml", channel.c_str())); + gSavedSettings.setString("ClientSettingsFile", settings_filename); + LL_INFOS() << "Using default settings filename from channel: " + << settings_filename << LL_ENDL; + } // - load overrides from user_settings loadSettingsFromDirectory(settings_w, "User"); diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp index e53de8be3..765f10736 100644 --- a/indra/newview/llversioninfo.cpp +++ b/indra/newview/llversioninfo.cpp @@ -141,6 +141,7 @@ LLVersionInfo::ViewerMaturity LLVersionInfo::getViewerMaturity() std::string channel = getChannel(); static const boost::regex is_test_channel("\\bTest\\b"); + static const boost::regex is_alpha_channel("\\bAlpha\\b"); static const boost::regex is_beta_channel("\\bBeta\\b"); static const boost::regex is_project_channel("\\bProject\\b"); static const boost::regex is_release_channel("\\bRelease\\b"); @@ -153,6 +154,10 @@ LLVersionInfo::ViewerMaturity LLVersionInfo::getViewerMaturity() { maturity = BETA_VIEWER; } + else if (boost::regex_search(channel, is_alpha_channel)) + { + maturity = ALPHA_VIEWER; + } else if (boost::regex_search(channel, is_project_channel)) { maturity = PROJECT_VIEWER; diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h index 4e75535ec..049b6056b 100644 --- a/indra/newview/llversioninfo.h +++ b/indra/newview/llversioninfo.h @@ -73,6 +73,7 @@ public: { TEST_VIEWER, PROJECT_VIEWER, + ALPHA_VIEWER, BETA_VIEWER, RELEASE_VIEWER } ViewerMaturity;