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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 extern const wchar_t kPathSeparator; | 35 extern const wchar_t kPathSeparator; |
36 | 36 |
37 | 37 |
38 //----------------------------------------------------------------------------- | 38 //----------------------------------------------------------------------------- |
39 // Functions that operate purely on a path string w/o touching the filesystem: | 39 // Functions that operate purely on a path string w/o touching the filesystem: |
40 | 40 |
41 // Returns a vector of all of the components of the provided path. | 41 // Returns a vector of all of the components of the provided path. |
42 void PathComponents(const std::wstring& path, | 42 void PathComponents(const std::wstring& path, |
43 std::vector<std::wstring>* components); | 43 std::vector<std::wstring>* components); |
44 | 44 |
45 // Returns true if the given path ends with a path separator character. | 45 // Returns true if the given path ends with a path separator character. |
46 // TODO(erikkay): remove this pointer version | 46 bool EndsWithSeparator(const FilePath& path); |
| 47 // These two versions are both deprecated. TODO(estade): remove them. |
47 bool EndsWithSeparator(std::wstring* path); | 48 bool EndsWithSeparator(std::wstring* path); |
48 bool EndsWithSeparator(const std::wstring& path); | 49 bool EndsWithSeparator(const std::wstring& path); |
49 | 50 |
| 51 // Makes sure that |path| ends with a separator IFF path is a directory that |
| 52 // exists. Returns true if |path| is an existing directory, false otherwise. |
| 53 bool EnsureEndsWithSeparator(FilePath* path); |
| 54 |
50 // Modifies a string by trimming all trailing separators from the end. | 55 // Modifies a string by trimming all trailing separators from the end. |
51 void TrimTrailingSeparator(std::wstring* dir); | 56 void TrimTrailingSeparator(std::wstring* dir); |
52 | 57 |
53 // Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not | 58 // Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not |
54 // refer to a file. | 59 // refer to a file. |
55 // If 'dir' is a root directory, return without change. | 60 // If 'dir' is a root directory, return without change. |
56 void UpOneDirectory(std::wstring* dir); | 61 void UpOneDirectory(std::wstring* dir); |
57 | 62 |
58 // Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not | 63 // Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not |
59 // refer to a file. | 64 // refer to a file. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 406 |
402 // Renames a file using the SHFileOperation API to ensure that the target file | 407 // Renames a file using the SHFileOperation API to ensure that the target file |
403 // gets the correct default security descriptor in the new path. | 408 // gets the correct default security descriptor in the new path. |
404 bool RenameFileAndResetSecurityDescriptor( | 409 bool RenameFileAndResetSecurityDescriptor( |
405 const std::wstring& source_file_path, | 410 const std::wstring& source_file_path, |
406 const std::wstring& target_file_path); | 411 const std::wstring& target_file_path); |
407 | 412 |
408 } // namespace file_util | 413 } // namespace file_util |
409 | 414 |
410 #endif // BASE_FILE_UTIL_H_ | 415 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |