| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // as well. | 105 // as well. |
| 106 // | 106 // |
| 107 // If there are files existing under to_path, always overwrite. Returns true | 107 // If there are files existing under to_path, always overwrite. Returns true |
| 108 // if successful, false otherwise. Wildcards on the names are not supported. | 108 // if successful, false otherwise. Wildcards on the names are not supported. |
| 109 // | 109 // |
| 110 // If you only need to copy a file use CopyFile, it's faster. | 110 // If you only need to copy a file use CopyFile, it's faster. |
| 111 BASE_EXPORT bool CopyDirectory(const FilePath& from_path, | 111 BASE_EXPORT bool CopyDirectory(const FilePath& from_path, |
| 112 const FilePath& to_path, | 112 const FilePath& to_path, |
| 113 bool recursive); | 113 bool recursive); |
| 114 | 114 |
| 115 // Returns true if the given path exists on the local filesystem, |
| 116 // false otherwise. |
| 117 BASE_EXPORT bool PathExists(const FilePath& path); |
| 118 |
| 115 } // namespace base | 119 } // namespace base |
| 116 | 120 |
| 117 // ----------------------------------------------------------------------------- | 121 // ----------------------------------------------------------------------------- |
| 118 | 122 |
| 119 namespace file_util { | 123 namespace file_util { |
| 120 | 124 |
| 121 // Returns true if the given path exists on the local filesystem, | |
| 122 // false otherwise. | |
| 123 BASE_EXPORT bool PathExists(const base::FilePath& path); | |
| 124 | |
| 125 // Returns true if the given path is writable by the user, false otherwise. | 125 // Returns true if the given path is writable by the user, false otherwise. |
| 126 BASE_EXPORT bool PathIsWritable(const base::FilePath& path); | 126 BASE_EXPORT bool PathIsWritable(const base::FilePath& path); |
| 127 | 127 |
| 128 // Returns true if the given path exists and is a directory, false otherwise. | 128 // Returns true if the given path exists and is a directory, false otherwise. |
| 129 BASE_EXPORT bool DirectoryExists(const base::FilePath& path); | 129 BASE_EXPORT bool DirectoryExists(const base::FilePath& path); |
| 130 | 130 |
| 131 // Returns true if the contents of the two files given are equal, false | 131 // Returns true if the contents of the two files given are equal, false |
| 132 // otherwise. If either file can't be read, returns false. | 132 // otherwise. If either file can't be read, returns false. |
| 133 BASE_EXPORT bool ContentsEqual(const base::FilePath& filename1, | 133 BASE_EXPORT bool ContentsEqual(const base::FilePath& filename1, |
| 134 const base::FilePath& filename2); | 134 const base::FilePath& filename2); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 // This function simulates Move(), but unlike Move() it works across volumes. | 455 // This function simulates Move(), but unlike Move() it works across volumes. |
| 456 // This fuction is not transactional. | 456 // This fuction is not transactional. |
| 457 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 457 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 458 const FilePath& to_path); | 458 const FilePath& to_path); |
| 459 #endif // defined(OS_WIN) | 459 #endif // defined(OS_WIN) |
| 460 | 460 |
| 461 } // namespace internal | 461 } // namespace internal |
| 462 } // namespace base | 462 } // namespace base |
| 463 | 463 |
| 464 #endif // BASE_FILE_UTIL_H_ | 464 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |