OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 //----------------------------------------------------------------------------- | 42 //----------------------------------------------------------------------------- |
43 // Functions that operate purely on a path string w/o touching the filesystem: | 43 // Functions that operate purely on a path string w/o touching the filesystem: |
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 bool EndsWithSeparator(const FilePath& path); | 46 bool EndsWithSeparator(const FilePath& path); |
47 | 47 |
48 // Makes sure that |path| ends with a separator IFF path is a directory that | 48 // Makes sure that |path| ends with a separator IFF path is a directory that |
49 // exists. Returns true if |path| is an existing directory, false otherwise. | 49 // exists. Returns true if |path| is an existing directory, false otherwise. |
50 bool EnsureEndsWithSeparator(FilePath* path); | 50 bool EnsureEndsWithSeparator(FilePath* path); |
51 | 51 |
52 // Appends new_ending to path, adding a separator between the two if necessary. | |
53 void AppendToPath(std::wstring* path, const std::wstring& new_ending); | |
54 | |
55 // Convert provided relative path into an absolute path. Returns false on | 52 // Convert provided relative path into an absolute path. Returns false on |
56 // error. On POSIX, this function fails if the path does not exist. | 53 // error. On POSIX, this function fails if the path does not exist. |
57 bool AbsolutePath(FilePath* path); | 54 bool AbsolutePath(FilePath* path); |
58 | 55 |
59 // Returns true if |parent| contains |child|. Both paths are converted to | 56 // Returns true if |parent| contains |child|. Both paths are converted to |
60 // absolute paths before doing the comparison. | 57 // absolute paths before doing the comparison. |
61 bool ContainsPath(const FilePath& parent, const FilePath& child); | 58 bool ContainsPath(const FilePath& parent, const FilePath& child); |
62 | 59 |
63 //----------------------------------------------------------------------------- | 60 //----------------------------------------------------------------------------- |
64 // Functions that involve filesystem access or modification: | 61 // Functions that involve filesystem access or modification: |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, | 495 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, |
499 const base::Time& cutoff_time); | 496 const base::Time& cutoff_time); |
500 | 497 |
501 } // namespace file_util | 498 } // namespace file_util |
502 | 499 |
503 // Deprecated functions have been moved to this separate header file, | 500 // Deprecated functions have been moved to this separate header file, |
504 // which must be included last after all the above definitions. | 501 // which must be included last after all the above definitions. |
505 #include "base/file_util_deprecated.h" | 502 #include "base/file_util_deprecated.h" |
506 | 503 |
507 #endif // BASE_FILE_UTIL_H_ | 504 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |