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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 DCHECKs 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 | |
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; | 121 virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path) = 0; |
124 | 122 |
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 | |
127 // succeeds. | |
128 virtual bool CopyFile(const Pathname &old_path, const Pathname &new_path) = 0; | |
129 | |
130 // Returns true if pathname refers to a directory | 123 // Returns true if pathname refers to a directory |
131 virtual bool IsFolder(const Pathname& pathname) = 0; | 124 virtual bool IsFolder(const Pathname& pathname) = 0; |
132 | 125 |
133 // Returns true if pathname refers to a file | 126 // Returns true if pathname refers to a file |
134 virtual bool IsFile(const Pathname& pathname) = 0; | 127 virtual bool IsFile(const Pathname& pathname) = 0; |
135 | 128 |
136 // Returns true if pathname refers to no filesystem object, every parent | 129 // Returns true if pathname refers to no filesystem object, every parent |
137 // directory either exists, or is also absent. | 130 // directory either exists, or is also absent. |
138 virtual bool IsAbsent(const Pathname& pathname) = 0; | 131 virtual bool IsAbsent(const Pathname& pathname) = 0; |
139 | 132 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 216 } |
224 | 217 |
225 static bool DeleteFolderAndContents(const Pathname &folder) { | 218 static bool DeleteFolderAndContents(const Pathname &folder) { |
226 return EnsureDefaultFilesystem()->DeleteFolderAndContents(folder); | 219 return EnsureDefaultFilesystem()->DeleteFolderAndContents(folder); |
227 } | 220 } |
228 | 221 |
229 static bool MoveFile(const Pathname &old_path, const Pathname &new_path) { | 222 static bool MoveFile(const Pathname &old_path, const Pathname &new_path) { |
230 return EnsureDefaultFilesystem()->MoveFile(old_path, new_path); | 223 return EnsureDefaultFilesystem()->MoveFile(old_path, new_path); |
231 } | 224 } |
232 | 225 |
233 static bool CopyFile(const Pathname &old_path, const Pathname &new_path) { | |
234 return EnsureDefaultFilesystem()->CopyFile(old_path, new_path); | |
235 } | |
236 | |
237 static bool IsFolder(const Pathname& pathname) { | 226 static bool IsFolder(const Pathname& pathname) { |
238 return EnsureDefaultFilesystem()->IsFolder(pathname); | 227 return EnsureDefaultFilesystem()->IsFolder(pathname); |
239 } | 228 } |
240 | 229 |
241 static bool IsFile(const Pathname &pathname) { | 230 static bool IsFile(const Pathname &pathname) { |
242 return EnsureDefaultFilesystem()->IsFile(pathname); | 231 return EnsureDefaultFilesystem()->IsFile(pathname); |
243 } | 232 } |
244 | 233 |
245 static bool IsAbsent(const Pathname &pathname) { | 234 static bool IsAbsent(const Pathname &pathname) { |
246 return EnsureDefaultFilesystem()->IsAbsent(pathname); | 235 return EnsureDefaultFilesystem()->IsAbsent(pathname); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 private: | 281 private: |
293 static FilesystemInterface* default_filesystem_; | 282 static FilesystemInterface* default_filesystem_; |
294 | 283 |
295 static FilesystemInterface *EnsureDefaultFilesystem(); | 284 static FilesystemInterface *EnsureDefaultFilesystem(); |
296 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); | 285 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); |
297 }; | 286 }; |
298 | 287 |
299 } // namespace rtc | 288 } // namespace rtc |
300 | 289 |
301 #endif // WEBRTC_BASE_FILEUTILS_H_ | 290 #endif // WEBRTC_BASE_FILEUTILS_H_ |
OLD | NEW |