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

Side by Side Diff: base/base_paths_posix.cc

Issue 449048: Move some XDG code from chrome to base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix linux base_unittest Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/base_paths.h ('k') | base/linux_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is really Posix minus Mac. Mac code is in base_paths_mac.mm.
6
5 #include "base/base_paths.h" 7 #include "base/base_paths.h"
6 8
7 #include <unistd.h> 9 #include <unistd.h>
8 10
9 #include "base/file_path.h" 11 #include "base/file_path.h"
10 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/linux_util.h"
11 #include "base/logging.h" 14 #include "base/logging.h"
12 #include "base/path_service.h" 15 #include "base/path_service.h"
13 #include "base/string_piece.h" 16 #include "base/scoped_ptr.h"
14 #include "base/sys_string_conversions.h" 17 #include "base/sys_string_conversions.h"
15 18
16 namespace base { 19 namespace base {
17 20
18 #if defined(OS_LINUX) 21 #if defined(OS_LINUX)
19 const char kSelfExe[] = "/proc/self/exe"; 22 const char kSelfExe[] = "/proc/self/exe";
20 #elif defined(OS_FREEBSD) 23 #elif defined(OS_FREEBSD)
21 const char kSelfExe[] = "/proc/curproc/file"; 24 const char kSelfExe[] = "/proc/curproc/file";
22 #endif 25 #endif
23 26
(...skipping 25 matching lines...) Expand all
49 // If that failed (maybe the build output is symlinked to a different 52 // If that failed (maybe the build output is symlinked to a different
50 // drive) try assuming the current directory is the source root. 53 // drive) try assuming the current directory is the source root.
51 if (file_util::GetCurrentDirectory(&path) && 54 if (file_util::GetCurrentDirectory(&path) &&
52 file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { 55 file_util::PathExists(path.Append("base/base_paths_posix.cc"))) {
53 *result = path; 56 *result = path;
54 return true; 57 return true;
55 } 58 }
56 LOG(ERROR) << "Couldn't find your source root. " 59 LOG(ERROR) << "Couldn't find your source root. "
57 << "Try running from your chromium/src directory."; 60 << "Try running from your chromium/src directory.";
58 return false; 61 return false;
62 case base::DIR_USER_CACHE:
63 scoped_ptr<base::EnvironmentVariableGetter> env(
64 base::EnvironmentVariableGetter::Create());
65 FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME",
66 ".cache"));
67 *result = cache_dir;
68 return true;
59 } 69 }
60 return false; 70 return false;
61 } 71 }
62 72
63 } // namespace base 73 } // namespace base
OLDNEW
« no previous file with comments | « base/base_paths.h ('k') | base/linux_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698