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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 namespace base { | 40 namespace base { |
41 class Time; | 41 class Time; |
42 } | 42 } |
43 | 43 |
44 namespace file_util { | 44 namespace file_util { |
45 | 45 |
46 extern bool g_bug108724_debug; | 46 extern bool g_bug108724_debug; |
47 | 47 |
48 //----------------------------------------------------------------------------- | 48 //----------------------------------------------------------------------------- |
49 // Functions that operate purely on a path string w/o touching the filesystem: | |
50 | |
51 // Returns true if the given path ends with a path separator character. | |
52 BASE_EXPORT bool EndsWithSeparator(const base::FilePath& path); | |
53 | |
54 // Makes sure that |path| ends with a separator IFF path is a directory that | |
55 // exists. Returns true if |path| is an existing directory, false otherwise. | |
56 BASE_EXPORT bool EnsureEndsWithSeparator(base::FilePath* path); | |
57 | |
58 // Convert provided relative path into an absolute path. Returns false on | |
59 // error. On POSIX, this function fails if the path does not exist. | |
60 BASE_EXPORT bool AbsolutePath(base::FilePath* path); | |
61 | |
62 // Returns true if |parent| contains |child|. Both paths are converted to | |
63 // absolute paths before doing the comparison. | |
64 BASE_EXPORT bool ContainsPath(const base::FilePath& parent, | |
65 const base::FilePath& child); | |
66 | |
67 //----------------------------------------------------------------------------- | |
68 // Functions that involve filesystem access or modification: | 49 // Functions that involve filesystem access or modification: |
69 | 50 |
70 // Returns the number of files matching the current path that were | 51 // Returns the number of files matching the current path that were |
71 // created on or after the given |file_time|. Doesn't count ".." or ".". | 52 // created on or after the given |file_time|. Doesn't count ".." or ".". |
72 // | 53 // |
73 // Note for POSIX environments: a file created before |file_time| | 54 // Note for POSIX environments: a file created before |file_time| |
74 // can be mis-detected as a newer file due to low precision of | 55 // can be mis-detected as a newer file due to low precision of |
75 // timestmap of file creation time. If you need to avoid such | 56 // timestmap of file creation time. If you need to avoid such |
76 // mis-detection perfectly, you should wait one second before | 57 // mis-detection perfectly, you should wait one second before |
77 // obtaining |file_time|. | 58 // obtaining |file_time|. |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 563 |
583 // Attempts determine the FileSystemType for |path|. | 564 // Attempts determine the FileSystemType for |path|. |
584 // Returns false if |path| doesn't exist. | 565 // Returns false if |path| doesn't exist. |
585 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, | 566 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, |
586 FileSystemType* type); | 567 FileSystemType* type); |
587 #endif | 568 #endif |
588 | 569 |
589 } // namespace file_util | 570 } // namespace file_util |
590 | 571 |
591 #endif // BASE_FILE_UTIL_H_ | 572 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |