Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: chrome/common/chrome_paths_linux.cc

Issue 6528028: Cleanup: Make chrome paths code more consistent and use more constants when p... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/chrome_paths.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_paths_linux.cc
===================================================================
--- chrome/common/chrome_paths_linux.cc (revision 74997)
+++ chrome/common/chrome_paths_linux.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,14 @@
#include "base/scoped_ptr.h"
#include "base/nix/xdg_util.h"
+namespace {
+
+const char kDotConfigDir[] = ".config";
+const char kDownloadsDir[] = "Downloads";
+const char kXdgConfigHomeEnvVar[] = "XDG_CONFIG_HOME";
+
+} // namespace
+
namespace chrome {
// See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
@@ -19,8 +27,9 @@
// (This also helps us sidestep issues with other apps grabbing ~/.chromium .)
bool GetDefaultUserDataDirectory(FilePath* result) {
scoped_ptr<base::Environment> env(base::Environment::Create());
- FilePath config_dir(
- base::nix::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config"));
+ FilePath config_dir(base::nix::GetXDGDirectory(env.get(),
+ kXdgConfigHomeEnvVar,
+ kDotConfigDir));
#if defined(GOOGLE_CHROME_BUILD)
*result = config_dir.Append("google-chrome");
#else
@@ -46,8 +55,9 @@
FilePath cache_dir;
if (!PathService::Get(base::DIR_CACHE, &cache_dir))
return;
- FilePath config_dir(
- base::nix::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config"));
+ FilePath config_dir(base::nix::GetXDGDirectory(env.get(),
+ kXdgConfigHomeEnvVar,
+ kDotConfigDir));
if (!config_dir.AppendRelativePath(profile_dir, &cache_dir))
return;
@@ -57,8 +67,9 @@
bool GetChromeFrameUserDataDirectory(FilePath* result) {
scoped_ptr<base::Environment> env(base::Environment::Create());
- FilePath config_dir(
- base::nix::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config"));
+ FilePath config_dir(base::nix::GetXDGDirectory(env.get(),
+ kXdgConfigHomeEnvVar,
+ kDotConfigDir));
#if defined(GOOGLE_CHROME_BUILD)
*result = config_dir.Append("google-chrome-frame");
#else
@@ -77,18 +88,19 @@
// ~ or their desktop directory, in which case we default to ~/Downloads.
bool GetUserDownloadsDirectory(FilePath* result) {
scoped_ptr<base::Environment> env(base::Environment::Create());
- *result = base::nix::GetXDGUserDirectory(env.get(), "DOWNLOAD", "Downloads");
+ *result = base::nix::GetXDGUserDirectory(env.get(), "DOWNLOAD",
+ kDownloadsDir);
FilePath home = file_util::GetHomeDir();
if (*result == home) {
- *result = home.Append("Downloads");
+ *result = home.Append(kDownloadsDir);
return true;
}
FilePath desktop;
GetUserDesktop(&desktop);
if (*result == desktop) {
- *result = home.Append("Downloads");
+ *result = home.Append(kDownloadsDir);
}
return true;
« no previous file with comments | « chrome/common/chrome_paths.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698