OLD | NEW |
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 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, | 179 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, |
180 bool recursive); | 180 bool recursive); |
181 | 181 |
182 // Returns true if the given path exists on the local filesystem, | 182 // Returns true if the given path exists on the local filesystem, |
183 // false otherwise. | 183 // false otherwise. |
184 bool PathExists(const FilePath& path); | 184 bool PathExists(const FilePath& path); |
185 // Deprecated temporary compatibility function. | 185 // Deprecated temporary compatibility function. |
186 bool PathExists(const std::wstring& path); | 186 bool PathExists(const std::wstring& path); |
187 | 187 |
188 // Returns true if the given path is writable by the user, false otherwise. | 188 // Returns true if the given path is writable by the user, false otherwise. |
| 189 bool PathIsWritable(const FilePath& path); |
| 190 // Deprecated temporary compatibility function. |
189 bool PathIsWritable(const std::wstring& path); | 191 bool PathIsWritable(const std::wstring& path); |
190 | 192 |
191 // Returns true if the given path exists and is a directory, false otherwise. | 193 // Returns true if the given path exists and is a directory, false otherwise. |
192 bool DirectoryExists(const FilePath& path); | 194 bool DirectoryExists(const FilePath& path); |
193 // Deprecated temporary compatibility function. | 195 // Deprecated temporary compatibility function. |
194 bool DirectoryExists(const std::wstring& path); | 196 bool DirectoryExists(const std::wstring& path); |
195 | 197 |
196 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
197 // Gets the creation time of the given file (expressed in the local timezone), | 199 // Gets the creation time of the given file (expressed in the local timezone), |
198 // and returns it via the creation_time parameter. Returns true if successful, | 200 // and returns it via the creation_time parameter. Returns true if successful, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 bool CreateTemporaryFileName(FilePath* path); | 268 bool CreateTemporaryFileName(FilePath* path); |
267 // Deprecated temporary compatibility function. | 269 // Deprecated temporary compatibility function. |
268 bool CreateTemporaryFileName(std::wstring* temp_file); | 270 bool CreateTemporaryFileName(std::wstring* temp_file); |
269 | 271 |
270 // Same as CreateTemporaryFileName but the file is created in |dir|. | 272 // Same as CreateTemporaryFileName but the file is created in |dir|. |
271 bool CreateTemporaryFileNameInDir(const std::wstring& dir, | 273 bool CreateTemporaryFileNameInDir(const std::wstring& dir, |
272 std::wstring* temp_file); | 274 std::wstring* temp_file); |
273 | 275 |
274 // Create a new directory under TempPath. If prefix is provided, the new | 276 // Create a new directory under TempPath. If prefix is provided, the new |
275 // directory name is in the format of prefixyyyy. | 277 // directory name is in the format of prefixyyyy. |
| 278 // NOTE: prefix is ignored in the POSIX implementation. |
| 279 // TODO(erikkay): is this OK? |
276 // If success, return true and output the full path of the directory created. | 280 // If success, return true and output the full path of the directory created. |
| 281 bool CreateNewTempDirectory(const FilePath::StringType& prefix, |
| 282 FilePath* new_temp_path); |
| 283 // Deprecated temporary compatibility function. |
277 bool CreateNewTempDirectory(const std::wstring& prefix, | 284 bool CreateNewTempDirectory(const std::wstring& prefix, |
278 std::wstring* new_temp_path); | 285 std::wstring* new_temp_path); |
279 | 286 |
280 // Creates a directory, as well as creating any parent directories, if they | 287 // Creates a directory, as well as creating any parent directories, if they |
281 // don't exist. Returns 'true' on successful creation, or if the directory | 288 // don't exist. Returns 'true' on successful creation, or if the directory |
282 // already exists. | 289 // already exists. |
283 bool CreateDirectory(const FilePath& full_path); | 290 bool CreateDirectory(const FilePath& full_path); |
284 // Deprecated temporary compatibility function. | 291 // Deprecated temporary compatibility function. |
285 bool CreateDirectory(const std::wstring& full_path); | 292 bool CreateDirectory(const std::wstring& full_path); |
286 | 293 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 463 |
457 // Renames a file using the SHFileOperation API to ensure that the target file | 464 // Renames a file using the SHFileOperation API to ensure that the target file |
458 // gets the correct default security descriptor in the new path. | 465 // gets the correct default security descriptor in the new path. |
459 bool RenameFileAndResetSecurityDescriptor( | 466 bool RenameFileAndResetSecurityDescriptor( |
460 const std::wstring& source_file_path, | 467 const std::wstring& source_file_path, |
461 const std::wstring& target_file_path); | 468 const std::wstring& target_file_path); |
462 | 469 |
463 } // namespace file_util | 470 } // namespace file_util |
464 | 471 |
465 #endif // BASE_FILE_UTIL_H_ | 472 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |