| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // Extra characters will be appended to |prefix| to ensure that the | 262 // Extra characters will be appended to |prefix| to ensure that the |
| 263 // new directory does not have the same name as an existing directory. | 263 // new directory does not have the same name as an existing directory. |
| 264 BASE_EXPORT bool CreateTemporaryDirInDir( | 264 BASE_EXPORT bool CreateTemporaryDirInDir( |
| 265 const base::FilePath& base_dir, | 265 const base::FilePath& base_dir, |
| 266 const base::FilePath::StringType& prefix, | 266 const base::FilePath::StringType& prefix, |
| 267 base::FilePath* new_dir); | 267 base::FilePath* new_dir); |
| 268 | 268 |
| 269 // Creates a directory, as well as creating any parent directories, if they | 269 // Creates a directory, as well as creating any parent directories, if they |
| 270 // don't exist. Returns 'true' on successful creation, or if the directory | 270 // don't exist. Returns 'true' on successful creation, or if the directory |
| 271 // already exists. The directory is only readable by the current user. | 271 // already exists. The directory is only readable by the current user. |
| 272 // Returns true on success, leaving *error unchanged. |
| 273 // Returns false on failure and sets *error appropriately, if it is non-NULL. |
| 274 BASE_EXPORT bool CreateDirectoryAndGetError(const base::FilePath& full_path, |
| 275 base::PlatformFileError* error); |
| 276 |
| 277 // Backward-compatible convenience method for the above. |
| 272 BASE_EXPORT bool CreateDirectory(const base::FilePath& full_path); | 278 BASE_EXPORT bool CreateDirectory(const base::FilePath& full_path); |
| 273 | 279 |
| 274 // Returns the file size. Returns true on success. | 280 // Returns the file size. Returns true on success. |
| 275 BASE_EXPORT bool GetFileSize(const base::FilePath& file_path, int64* file_size); | 281 BASE_EXPORT bool GetFileSize(const base::FilePath& file_path, int64* file_size); |
| 276 | 282 |
| 277 // Sets |real_path| to |path| with symbolic links and junctions expanded. | 283 // Sets |real_path| to |path| with symbolic links and junctions expanded. |
| 278 // On windows, make sure the path starts with a lettered drive. | 284 // On windows, make sure the path starts with a lettered drive. |
| 279 // |path| must reference a file. Function will fail if |path| points to | 285 // |path| must reference a file. Function will fail if |path| points to |
| 280 // a directory or to a nonexistent path. On windows, this function will | 286 // a directory or to a nonexistent path. On windows, this function will |
| 281 // fail if |path| is a junction or symlink that points to an empty file, | 287 // fail if |path| is a junction or symlink that points to an empty file, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 450 |
| 445 // Attempts determine the FileSystemType for |path|. | 451 // Attempts determine the FileSystemType for |path|. |
| 446 // Returns false if |path| doesn't exist. | 452 // Returns false if |path| doesn't exist. |
| 447 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, | 453 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, |
| 448 FileSystemType* type); | 454 FileSystemType* type); |
| 449 #endif | 455 #endif |
| 450 | 456 |
| 451 } // namespace file_util | 457 } // namespace file_util |
| 452 | 458 |
| 453 #endif // BASE_FILE_UTIL_H_ | 459 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |