OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 virtual DirectoryIterator* IterateDirectory(); | 85 virtual DirectoryIterator* IterateDirectory(); |
86 | 86 |
87 // Opens a file. Returns an open StreamInterface if function succeeds. | 87 // Opens a file. Returns an open StreamInterface if function succeeds. |
88 // Otherwise, returns NULL. | 88 // Otherwise, returns NULL. |
89 // TODO: Add an error param to indicate failure reason, similar to | 89 // TODO: Add an error param to indicate failure reason, similar to |
90 // FileStream::Open | 90 // FileStream::Open |
91 virtual FileStream *OpenFile(const Pathname &filename, | 91 virtual FileStream *OpenFile(const Pathname &filename, |
92 const std::string &mode) = 0; | 92 const std::string &mode) = 0; |
93 | 93 |
94 // This will attempt to delete the path located at filename. | 94 // This will attempt to delete the path located at filename. |
95 // It ASSERTS and returns false if the path points to a folder or a | 95 // It DCHECKs and returns false if the path points to a folder or a |
96 // non-existent file. | 96 // non-existent file. |
kwiberg-webrtc
2017/01/23 12:25:14
Not your fault, but I'll just point out that this
nisse-webrtc
2017/01/23 12:53:03
When I get to erplacing use of VERIFY, there's a c
kwiberg-webrtc
2017/01/23 14:11:58
I don't know. But I do know that DCHECK is the wro
| |
97 virtual bool DeleteFile(const Pathname &filename) = 0; | 97 virtual bool DeleteFile(const Pathname &filename) = 0; |
98 | 98 |
99 // This will attempt to delete the empty folder located at 'folder' | 99 // This will attempt to delete the empty folder located at 'folder' |
100 // It ASSERTS and returns false if the path points to a file or a non-existent | 100 // It DCHECKs and returns false if the path points to a file or a non-existent |
101 // folder. It fails normally if the folder is not empty or can otherwise | 101 // folder. It fails normally if the folder is not empty or can otherwise |
102 // not be deleted. | 102 // not be deleted. |
103 virtual bool DeleteEmptyFolder(const Pathname &folder) = 0; | 103 virtual bool DeleteEmptyFolder(const Pathname &folder) = 0; |
104 | 104 |
105 // This will call IterateDirectory, to get a directory iterator, and then | 105 // This will call IterateDirectory, to get a directory iterator, and then |
106 // call DeleteFolderAndContents and DeleteFile on every path contained in this | 106 // call DeleteFolderAndContents and DeleteFile on every path contained in this |
107 // folder. If the folder is empty, this returns true. | 107 // folder. If the folder is empty, this returns true. |
108 virtual bool DeleteFolderContents(const Pathname &folder); | 108 virtual bool DeleteFolderContents(const Pathname &folder); |
109 | 109 |
110 // This deletes the contents of a folder, recursively, and then deletes | 110 // This deletes the contents of a folder, recursively, and then deletes |
111 // the folder itself. | 111 // the folder itself. |
112 virtual bool DeleteFolderAndContents(const Pathname& folder); | 112 virtual bool DeleteFolderAndContents(const Pathname& folder); |
113 | 113 |
114 // Creates a directory. This will call itself recursively to create /foo/bar | 114 // Creates a directory. This will call itself recursively to create /foo/bar |
115 // even if /foo does not exist. Returns true if the function succeeds. | 115 // even if /foo does not exist. Returns true if the function succeeds. |
116 virtual bool CreateFolder(const Pathname &pathname) = 0; | 116 virtual bool CreateFolder(const Pathname &pathname) = 0; |
117 | 117 |
118 // This moves a file from old_path to new_path, where "old_path" is a | 118 // This moves a file from old_path to new_path, where "old_path" is a |
119 // plain file. This ASSERTs and returns false if old_path points to a | 119 // plain file. This DCHECKs and returns false if old_path points to a |
120 // directory, and returns true if the function succeeds. | 120 // directory, and returns true if the function succeeds. |
121 // If the new path is on a different volume than the old path, this function | 121 // If the new path is on a different volume than the old path, this function |
122 // will attempt to copy and, if that succeeds, delete the old path. | 122 // will attempt to copy and, if that succeeds, delete the old path. |
123 virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path) = 0; | 123 virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path) = 0; |
124 | 124 |
125 // This copies a file from old_path to new_path. This method ASSERTs and | 125 // This copies a file from old_path to new_path. This method DCHECKs and |
126 // returns false if old_path is a folder, and returns true if the copy | 126 // returns false if old_path is a folder, and returns true if the copy |
127 // succeeds. | 127 // succeeds. |
128 virtual bool CopyFile(const Pathname &old_path, const Pathname &new_path) = 0; | 128 virtual bool CopyFile(const Pathname &old_path, const Pathname &new_path) = 0; |
129 | 129 |
130 // Returns true if pathname refers to a directory | 130 // Returns true if pathname refers to a directory |
131 virtual bool IsFolder(const Pathname& pathname) = 0; | 131 virtual bool IsFolder(const Pathname& pathname) = 0; |
132 | 132 |
133 // Returns true if pathname refers to a file | 133 // Returns true if pathname refers to a file |
134 virtual bool IsFile(const Pathname& pathname) = 0; | 134 virtual bool IsFile(const Pathname& pathname) = 0; |
135 | 135 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 Filesystem::set_default_filesystem(old_fs_); | 320 Filesystem::set_default_filesystem(old_fs_); |
321 } | 321 } |
322 private: | 322 private: |
323 FilesystemInterface* old_fs_; | 323 FilesystemInterface* old_fs_; |
324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); | 324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); |
325 }; | 325 }; |
326 | 326 |
327 } // namespace rtc | 327 } // namespace rtc |
328 | 328 |
329 #endif // WEBRTC_BASE_FILEUTILS_H_ | 329 #endif // WEBRTC_BASE_FILEUTILS_H_ |
OLD | NEW |