summaryrefslogtreecommitdiffstats
path: root/base/nix
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 22:57:13 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 22:57:13 +0000
commit18165d744e7e9f1d31591a4c3d5b500a9a5cddd1 (patch)
tree8e74e70233862e7f6a3917bcecd7a0c2406cd941 /base/nix
parent49602c10164ef3a4b2c35663e7b06fc20f108a8b (diff)
downloadchromium_src-18165d744e7e9f1d31591a4c3d5b500a9a5cddd1.zip
chromium_src-18165d744e7e9f1d31591a4c3d5b500a9a5cddd1.tar.gz
chromium_src-18165d744e7e9f1d31591a4c3d5b500a9a5cddd1.tar.bz2
Cleanup: Remove unused parameter in base::nix::GetXDGUserDirectory(). Make sure base::nix::GetXDG* returns FilePaths with the trailing separators stripped.
BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10499006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/nix')
-rw-r--r--base/nix/xdg_util.cc20
-rw-r--r--base/nix/xdg_util.h4
2 files changed, 15 insertions, 9 deletions
diff --git a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc
index c59578d..7d26344 100644
--- a/base/nix/xdg_util.cc
+++ b/base/nix/xdg_util.cc
@@ -4,6 +4,8 @@
#include "base/nix/xdg_util.h"
+#include <string>
+
#include "base/environment.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -14,21 +16,25 @@ namespace nix {
FilePath GetXDGDirectory(Environment* env, const char* env_name,
const char* fallback_dir) {
+ FilePath path;
std::string env_value;
if (env->GetVar(env_name, &env_value) && !env_value.empty())
- return FilePath(env_value);
- return file_util::GetHomeDir().Append(fallback_dir);
+ path = FilePath(env_value);
+ else
+ path = file_util::GetHomeDir().Append(fallback_dir);
+ return path.StripTrailingSeparators();
}
-FilePath GetXDGUserDirectory(Environment* env, const char* dir_name,
- const char* fallback_dir) {
+FilePath GetXDGUserDirectory(const char* dir_name, const char* fallback_dir) {
+ FilePath path;
char* xdg_dir = xdg_user_dir_lookup(dir_name);
if (xdg_dir) {
- FilePath path(xdg_dir);
+ path = FilePath(xdg_dir);
free(xdg_dir);
- return path.StripTrailingSeparators();
+ } else {
+ path = file_util::GetHomeDir().Append(fallback_dir);
}
- return file_util::GetHomeDir().Append(fallback_dir);
+ return path.StripTrailingSeparators();
}
DesktopEnvironment GetDesktopEnvironment(Environment* env) {
diff --git a/base/nix/xdg_util.h b/base/nix/xdg_util.h
index 305a679..cb8072ce 100644
--- a/base/nix/xdg_util.h
+++ b/base/nix/xdg_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -38,7 +38,7 @@ BASE_EXPORT FilePath GetXDGDirectory(Environment* env, const char* env_name,
// Wrapper around xdg_user_dir_lookup() from src/base/third_party/xdg-user-dirs
// This looks up "well known" user directories like the desktop and music
// folder. Examples of |dir_name| are DESKTOP and MUSIC.
-BASE_EXPORT FilePath GetXDGUserDirectory(Environment* env, const char* dir_name,
+BASE_EXPORT FilePath GetXDGUserDirectory(const char* dir_name,
const char* fallback_dir);
enum DesktopEnvironment {