From 7507619e14c79faf38e7946c81ceb2c532969832 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 25 May 2010 12:21:17 +0100 Subject: Add a --cache command line flag to set cache location --- linden/indra/newview/app_settings/cmd_line.xml | 10 ++++++++++ linden/indra/newview/app_settings/settings.xml | 11 +++++++++++ linden/indra/newview/llappviewer.cpp | 11 ++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/app_settings/cmd_line.xml b/linden/indra/newview/app_settings/cmd_line.xml index d2d8b74..f5c6cdb 100644 --- a/linden/indra/newview/app_settings/cmd_line.xml +++ b/linden/indra/newview/app_settings/cmd_line.xml @@ -52,6 +52,16 @@ CmdLineGridChoice + cache + + desc + Specify the location of the local cache directory. + count + 1 + map-to + CmdLineCacheLocation + + loginuri desc diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 2885239..89cf2ab 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -48,6 +48,17 @@ Value + CmdLineCacheLocation + + Comment + Command line specified cache location to use. + Persist + 0 + Type + String + Value + + DecimalsForTools Comment diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index 79a78b9..821742c 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp @@ -2915,16 +2915,21 @@ bool LLAppViewer::initCache() migrateCacheDirectory(); // Setup and verify the cache location - std::string cache_location = gSavedSettings.getString("CacheLocation"); + std::string cache_location = gSavedSettings.getString("CmdLineCacheLocation"); + if (cache_location.empty()) + { + cache_location = gSavedSettings.getString("CacheLocation"); + } std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); - if (new_cache_location != cache_location) + if ((new_cache_location != cache_location) && new_cache_location != "") { gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")); purgeCache(); // purge old cache gSavedSettings.setString("CacheLocation", new_cache_location); + cache_location = new_cache_location; } - if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"))) + if (!gDirUtilp->setCacheDir(cache_location)) { LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL; gSavedSettings.setString("CacheLocation", ""); -- cgit v1.1