diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-23 23:54:02 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-23 23:54:02 +0000 |
commit | e134a72dd5bc286a4ce3007817f53ff62d785055 (patch) | |
tree | b96f12bcc6ef7865f1aa28a9edf9e25f30ae3a43 /chrome/common/chrome_paths_linux.cc | |
parent | 5415e4f78c9f5a292fad5db68b224071d10d61dc (diff) | |
download | chromium_src-e134a72dd5bc286a4ce3007817f53ff62d785055.zip chromium_src-e134a72dd5bc286a4ce3007817f53ff62d785055.tar.gz chromium_src-e134a72dd5bc286a4ce3007817f53ff62d785055.tar.bz2 |
Obey the XDG base directory spec and use ~/.config/chromium on Linux.
As discussed here:
http://groups.google.com/group/chromium-dev/browse_thread/thread/41e9154311779e1a
Review URL: http://codereview.chromium.org/27069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_paths_linux.cc')
-rw-r--r-- | chrome/common/chrome_paths_linux.cc | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/chrome/common/chrome_paths_linux.cc b/chrome/common/chrome_paths_linux.cc index 9cbde97..cde9949 100644 --- a/chrome/common/chrome_paths_linux.cc +++ b/chrome/common/chrome_paths_linux.cc @@ -10,21 +10,27 @@ namespace chrome { -// Use ~/.chromium/ for Chromium and ~/.google/chrome for official builds. We -// use ~/.google/chrome because ~/.google/ is already used by other Google -// Linux apps. +// See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html +// for a spec on where config files go. The net effect for most +// systems is we use ~/.config/chromium/ for Chromium and +// ~/.config/google-chrome/ for official builds. +// (This also helps us sidestep issues with other apps grabbing ~/.chromium .) bool GetDefaultUserDataDirectory(FilePath* result) { - // The glib documentation says that g_get_home_dir doesn't honor HOME so we - // should try that first. - const char* home_dir = g_getenv("HOME"); - if (!home_dir) - home_dir = g_get_home_dir(); - *result = FilePath(home_dir); + FilePath config_dir; + const char* config_home = g_getenv("XDG_CONFIG_HOME"); + if (config_home && config_home[0]) { + config_dir = FilePath(config_home); + } else { + const char* home_dir = g_getenv("HOME"); + if (!home_dir) + home_dir = g_get_home_dir(); + config_dir = FilePath(home_dir).Append(".config"); + } + #if defined(GOOGLE_CHROME_BUILD) - *result = result->Append(".google"); - *result = result->Append("chrome"); + *result = config_dir.Append("google-chrome"); #else - *result = result->Append(".chromium"); + *result = config_dir.Append("chromium"); #endif return true; } |