Chromium Code Reviews| 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 #pragma once | 10 #pragma once |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // Note: | 110 // Note: |
| 111 // 1) The file/directory to be deleted should exist in a temp folder. | 111 // 1) The file/directory to be deleted should exist in a temp folder. |
| 112 // 2) The directory to be deleted must be empty. | 112 // 2) The directory to be deleted must be empty. |
| 113 BASE_EXPORT bool DeleteAfterReboot(const FilePath& path); | 113 BASE_EXPORT bool DeleteAfterReboot(const FilePath& path); |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 // Moves the given path, whether it's a file or a directory. | 116 // Moves the given path, whether it's a file or a directory. |
| 117 // If a simple rename is not possible, such as in the case where the paths are | 117 // If a simple rename is not possible, such as in the case where the paths are |
| 118 // on different volumes, this will attempt to copy and delete. Returns | 118 // on different volumes, this will attempt to copy and delete. Returns |
| 119 // true for success. | 119 // true for success. |
| 120 // If |to_path| already exists, it is overwritten. | |
|
gab
2012/04/27 01:40:21
This is already the current behavior, but I needed
| |
| 120 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); | 121 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); |
| 121 | 122 |
| 122 // Renames file |from_path| to |to_path|. Both paths must be on the same | 123 // Renames file |from_path| to |to_path|. Both paths must be on the same |
| 123 // volume, or the function will fail. Destination file will be created | 124 // volume, or the function will fail. Destination file will be created |
| 124 // if it doesn't exist. Prefer this function over Move when dealing with | 125 // if it doesn't exist. Prefer this function over Move when dealing with |
| 125 // temporary files. On Windows it preserves attributes of the target file. | 126 // temporary files. On Windows it preserves attributes of the target file. |
| 126 // Returns true on success. | 127 // Returns true on success. |
| 127 BASE_EXPORT bool ReplaceFile(const FilePath& from_path, | 128 BASE_EXPORT bool ReplaceFile(const FilePath& from_path, |
| 128 const FilePath& to_path); | 129 const FilePath& to_path); |
| 129 | 130 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 }; | 630 }; |
| 630 | 631 |
| 631 // Attempts determine the FileSystemType for |path|. | 632 // Attempts determine the FileSystemType for |path|. |
| 632 // Returns false if |path| doesn't exist. | 633 // Returns false if |path| doesn't exist. |
| 633 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 634 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
| 634 #endif | 635 #endif |
| 635 | 636 |
| 636 } // namespace file_util | 637 } // namespace file_util |
| 637 | 638 |
| 638 #endif // BASE_FILE_UTIL_H_ | 639 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |