OLD | NEW |
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 // Get a temporary directory for shared memory files. The directory may depend | 201 // Get a temporary directory for shared memory files. The directory may depend |
202 // on whether the destination is intended for executable files, which in turn | 202 // on whether the destination is intended for executable files, which in turn |
203 // depends on how /dev/shmem was mounted. As a result, you must supply whether | 203 // depends on how /dev/shmem was mounted. As a result, you must supply whether |
204 // you intend to create executable shmem segments so this function can find | 204 // you intend to create executable shmem segments so this function can find |
205 // an appropriate location. | 205 // an appropriate location. |
206 // | 206 // |
207 // Only useful on POSIX; redirects to GetTempDir() on Windows. | 207 // Only useful on POSIX; redirects to GetTempDir() on Windows. |
208 BASE_EXPORT bool GetShmemTempDir(bool executable, FilePath* path); | 208 BASE_EXPORT bool GetShmemTempDir(bool executable, FilePath* path); |
209 | 209 |
210 #if defined(OS_POSIX) | 210 // Get the home directory. This is more complicated than just getenv("HOME") |
211 // Get the home directory. This is more complicated than just getenv("HOME") | |
212 // as it knows to fall back on getpwent() etc. | 211 // as it knows to fall back on getpwent() etc. |
213 // | 212 // |
214 // This function is not currently implemented on Windows or Mac because we | 213 // You should not generally call this directly. Instead use DIR_HOME with the |
215 // don't use it. Generally you would use one of PathService's APP_DATA | 214 // path service which will use this function but cache the value. |
216 // directories on those platforms. If we need it, this could be implemented | |
217 // there to return the appropriate directory. | |
218 BASE_EXPORT FilePath GetHomeDir(); | 215 BASE_EXPORT FilePath GetHomeDir(); |
219 #endif // OS_POSIX | |
220 | 216 |
221 // Creates a temporary file. The full path is placed in |path|, and the | 217 // Creates a temporary file. The full path is placed in |path|, and the |
222 // function returns true if was successful in creating the file. The file will | 218 // function returns true if was successful in creating the file. The file will |
223 // be empty and all handles closed after this function returns. | 219 // be empty and all handles closed after this function returns. |
224 BASE_EXPORT bool CreateTemporaryFile(FilePath* path); | 220 BASE_EXPORT bool CreateTemporaryFile(FilePath* path); |
225 | 221 |
226 // Same as CreateTemporaryFile but the file is created in |dir|. | 222 // Same as CreateTemporaryFile but the file is created in |dir|. |
227 BASE_EXPORT bool CreateTemporaryFileInDir(const FilePath& dir, | 223 BASE_EXPORT bool CreateTemporaryFileInDir(const FilePath& dir, |
228 FilePath* temp_file); | 224 FilePath* temp_file); |
229 | 225 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // This function simulates Move(), but unlike Move() it works across volumes. | 458 // This function simulates Move(), but unlike Move() it works across volumes. |
463 // This function is not transactional. | 459 // This function is not transactional. |
464 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 460 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
465 const FilePath& to_path); | 461 const FilePath& to_path); |
466 #endif // defined(OS_WIN) | 462 #endif // defined(OS_WIN) |
467 | 463 |
468 } // namespace internal | 464 } // namespace internal |
469 } // namespace base | 465 } // namespace base |
470 | 466 |
471 #endif // BASE_FILE_UTIL_H_ | 467 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |