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

Side by Side Diff: base/base_paths_linux.cc

Issue 5123004: chrome_paths: refactor and sanitize cache directory handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more win Created 10 years, 1 month 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/base_paths_mac.mm » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "base/base_paths.h" 5 #include "base/base_paths.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #if defined(OS_FREEBSD) 8 #if defined(OS_FREEBSD)
9 #include <sys/param.h> 9 #include <sys/param.h>
10 #include <sys/sysctl.h> 10 #include <sys/sysctl.h>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // drive) try assuming the current directory is the source root. 98 // drive) try assuming the current directory is the source root.
99 if (file_util::GetCurrentDirectory(&path) && 99 if (file_util::GetCurrentDirectory(&path) &&
100 file_util::PathExists(path.Append(kThisSourceFile))) { 100 file_util::PathExists(path.Append(kThisSourceFile))) {
101 *result = path; 101 *result = path;
102 return true; 102 return true;
103 } 103 }
104 LOG(ERROR) << "Couldn't find your source root. " 104 LOG(ERROR) << "Couldn't find your source root. "
105 << "Try running from your chromium/src directory."; 105 << "Try running from your chromium/src directory.";
106 return false; 106 return false;
107 } 107 }
108 case base::DIR_USER_CACHE: 108 case base::DIR_CACHE:
109 scoped_ptr<base::Environment> env(base::Environment::Create()); 109 scoped_ptr<base::Environment> env(base::Environment::Create());
110 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", 110 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME",
111 ".cache")); 111 ".cache"));
112 *result = cache_dir; 112 *result = cache_dir;
113 return true; 113 return true;
114 } 114 }
115 return false; 115 return false;
116 } 116 }
117 117
118 } // namespace base 118 } // namespace base
OLDNEW
« no previous file with comments | « base/base_paths.h ('k') | base/base_paths_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698