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

Side by Side Diff: base/file_util.h

Issue 159833003: Add support for GetHomeDir for Mac and Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/base_paths_win.cc ('k') | base/file_util_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 file contains utility functions for dealing with the local 5 // This file contains utility functions for dealing with the local
6 // filesystem. 6 // filesystem.
7 7
8 #ifndef BASE_FILE_UTIL_H_ 8 #ifndef BASE_FILE_UTIL_H_
9 #define BASE_FILE_UTIL_H_ 9 #define BASE_FILE_UTIL_H_
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 // Get a temporary directory for shared memory files. The directory may depend 215 // Get a temporary directory for shared memory files. The directory may depend
216 // on whether the destination is intended for executable files, which in turn 216 // on whether the destination is intended for executable files, which in turn
217 // depends on how /dev/shmem was mounted. As a result, you must supply whether 217 // depends on how /dev/shmem was mounted. As a result, you must supply whether
218 // you intend to create executable shmem segments so this function can find 218 // you intend to create executable shmem segments so this function can find
219 // an appropriate location. 219 // an appropriate location.
220 // 220 //
221 // Only useful on POSIX; redirects to GetTempDir() on Windows. 221 // Only useful on POSIX; redirects to GetTempDir() on Windows.
222 BASE_EXPORT bool GetShmemTempDir(bool executable, FilePath* path); 222 BASE_EXPORT bool GetShmemTempDir(bool executable, FilePath* path);
223 223
224 #if defined(OS_POSIX) 224 // Get the home directory. This is more complicated than just getenv("HOME")
225 // Get the home directory. This is more complicated than just getenv("HOME")
226 // as it knows to fall back on getpwent() etc. 225 // as it knows to fall back on getpwent() etc.
227 // 226 //
228 // This function is not currently implemented on Windows or Mac because we 227 // You should not generally call this directly. Instead use DIR_HOME with the
229 // don't use it. Generally you would use one of PathService's APP_DATA 228 // path service which will use this function but cache the value.
230 // directories on those platforms. If we need it, this could be implemented
231 // there to return the appropriate directory.
232 BASE_EXPORT FilePath GetHomeDir(); 229 BASE_EXPORT FilePath GetHomeDir();
233 #endif // OS_POSIX
234 230
235 // Creates a temporary file. The full path is placed in |path|, and the 231 // Creates a temporary file. The full path is placed in |path|, and the
236 // function returns true if was successful in creating the file. The file will 232 // function returns true if was successful in creating the file. The file will
237 // be empty and all handles closed after this function returns. 233 // be empty and all handles closed after this function returns.
238 BASE_EXPORT bool CreateTemporaryFile(FilePath* path); 234 BASE_EXPORT bool CreateTemporaryFile(FilePath* path);
239 235
240 // Same as CreateTemporaryFile but the file is created in |dir|. 236 // Same as CreateTemporaryFile but the file is created in |dir|.
241 BASE_EXPORT bool CreateTemporaryFileInDir(const FilePath& dir, 237 BASE_EXPORT bool CreateTemporaryFileInDir(const FilePath& dir,
242 FilePath* temp_file); 238 FilePath* temp_file);
243 239
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // This function simulates Move(), but unlike Move() it works across volumes. 474 // This function simulates Move(), but unlike Move() it works across volumes.
479 // This function is not transactional. 475 // This function is not transactional.
480 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, 476 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
481 const FilePath& to_path); 477 const FilePath& to_path);
482 #endif // defined(OS_WIN) 478 #endif // defined(OS_WIN)
483 479
484 } // namespace internal 480 } // namespace internal
485 } // namespace base 481 } // namespace base
486 482
487 #endif // BASE_FILE_UTIL_H_ 483 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « base/base_paths_win.cc ('k') | base/file_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698