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

Unified Diff: chrome/common/chrome_paths_linux.cc

Issue 10392094: Add PathService::Get(chrome::DIR_USER_PICTURES). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: merge Created 8 years, 7 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_internal.h ('k') | chrome/common/chrome_paths_mac.mm » ('j') | 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 137529)
+++ chrome/common/chrome_paths_linux.cc (working copy)
@@ -7,13 +7,14 @@
#include "base/environment.h"
#include "base/file_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/nix/xdg_util.h"
#include "base/path_service.h"
-#include "base/nix/xdg_util.h"
namespace {
const char kDotConfigDir[] = ".config";
const char kDownloadsDir[] = "Downloads";
+const char kPicturesDir[] = "Pictures";
const char kXdgConfigHomeEnvVar[] = "XDG_CONFIG_HOME";
} // namespace
@@ -97,6 +98,25 @@
return true;
}
+// We respect the user's preferred pictures location, unless it is
+// ~ or their desktop directory, in which case we default to ~/Pictures.
+bool GetUserPicturesDirectory(FilePath* result) {
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ *result = base::nix::GetXDGUserDirectory(env.get(), "PICTURES", kPicturesDir);
+
+ FilePath home = file_util::GetHomeDir();
+ if (*result != home) {
+ FilePath desktop;
+ GetUserDesktop(&desktop);
+ if (*result != desktop) {
+ return true;
+ }
+ }
+
+ *result = home.Append(kPicturesDir);
+ return true;
+}
+
bool GetUserDesktop(FilePath* result) {
scoped_ptr<base::Environment> env(base::Environment::Create());
*result = base::nix::GetXDGUserDirectory(env.get(), "DESKTOP", "Desktop");
« no previous file with comments | « chrome/common/chrome_paths_internal.h ('k') | chrome/common/chrome_paths_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698