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 |
11 #ifndef _WEBRTC_BASE_WIN32FILESYSTEM_H__ | 11 #ifndef _WEBRTC_BASE_WIN32FILESYSTEM_H__ |
12 #define _WEBRTC_BASE_WIN32FILESYSTEM_H__ | 12 #define _WEBRTC_BASE_WIN32FILESYSTEM_H__ |
13 | 13 |
14 #include "fileutils.h" | 14 #include "fileutils.h" |
15 | 15 |
16 namespace rtc { | 16 namespace rtc { |
17 | 17 |
18 class Win32Filesystem : public FilesystemInterface { | 18 class Win32Filesystem : public FilesystemInterface { |
19 public: | 19 public: |
20 // This will attempt to delete the path located at filename. | 20 // This will attempt to delete the path located at filename. |
21 // If the path points to a folder, it will fail with VERIFY | 21 // If the path points to a folder, it will fail with VERIFY |
22 virtual bool DeleteFile(const Pathname &filename); | 22 bool DeleteFile(const Pathname& filename) override; |
23 | |
24 // This will attempt to delete an empty folder. If the path does not point to | |
25 // a folder, it fails with VERIFY. If the folder is not empty, it fails normal
ly | |
26 virtual bool DeleteEmptyFolder(const Pathname &folder); | |
27 | 23 |
28 // Creates a directory. This will call itself recursively to create /foo/bar e
ven if | 24 // Creates a directory. This will call itself recursively to create /foo/bar e
ven if |
29 // /foo does not exist. | 25 // /foo does not exist. |
30 // Returns TRUE if function succeeds | 26 // Returns TRUE if function succeeds |
31 virtual bool CreateFolder(const Pathname &pathname); | 27 bool CreateFolder(const Pathname& pathname) override; |
32 | 28 |
33 // This moves a file from old_path to new_path. If the new path is on a | 29 // This moves a file from old_path to new_path. If the new path is on a |
34 // different volume than the old, it will attempt to copy and then delete | 30 // different volume than the old, it will attempt to copy and then delete |
35 // the folder | 31 // the folder |
36 // Returns true if the file is successfully moved | 32 // Returns true if the file is successfully moved |
37 virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path); | 33 bool MoveFile(const Pathname& old_path, const Pathname& new_path) override; |
38 | 34 |
39 // Returns true if a pathname is a directory | 35 // Returns true if a pathname is a directory |
40 virtual bool IsFolder(const Pathname& pathname); | 36 bool IsFolder(const Pathname& pathname) override; |
41 | 37 |
42 // Returns true if a file exists at path | 38 // Returns true if a file exists at path |
43 virtual bool IsFile(const Pathname &path); | 39 bool IsFile(const Pathname& path) override; |
44 | 40 |
45 // Returns true if pathname refers to no filesystem object, every parent | 41 // Returns true if pathname refers to no filesystem object, every parent |
46 // directory either exists, or is also absent. | 42 // directory either exists, or is also absent. |
47 virtual bool IsAbsent(const Pathname& pathname); | 43 bool IsAbsent(const Pathname& pathname) override; |
48 | 44 |
49 // All of the following functions set pathname and return true if successful. | 45 // All of the following functions set pathname and return true if successful. |
50 // Returned paths always include a trailing backslash. | 46 // Returned paths always include a trailing backslash. |
51 // If create is true, the path will be recursively created. | 47 // If create is true, the path will be recursively created. |
52 // If append is non-null, it will be appended (and possibly created). | 48 // If append is non-null, it will be appended (and possibly created). |
53 | 49 |
54 virtual std::string TempFilename(const Pathname &dir, const std::string &prefi
x); | 50 std::string TempFilename(const Pathname& dir, |
| 51 const std::string& prefix) override; |
55 | 52 |
56 virtual bool GetFileSize(const Pathname& path, size_t* size); | 53 bool GetFileSize(const Pathname& path, size_t* size) override; |
57 virtual bool GetFileTime(const Pathname& path, FileTimeType which, | 54 bool GetFileTime(const Pathname& path, |
58 time_t* time); | 55 FileTimeType which, |
| 56 time_t* time) override; |
59 | 57 |
60 // A folder appropriate for storing temporary files (Contents are | 58 // A folder appropriate for storing temporary files (Contents are |
61 // automatically deleted when the program exists) | 59 // automatically deleted when the program exists) |
62 virtual bool GetTemporaryFolder(Pathname &path, bool create, | 60 bool GetTemporaryFolder(Pathname& path, |
63 const std::string *append); | 61 bool create, |
| 62 const std::string* append) override; |
64 | 63 |
65 private: | 64 private: |
66 // Returns the path to the running application. | 65 // Returns the path to the running application. |
67 bool GetAppPathname(Pathname* path); | 66 bool GetAppPathname(Pathname* path); |
68 }; | 67 }; |
69 | 68 |
70 } // namespace rtc | 69 } // namespace rtc |
71 | 70 |
72 #endif // WEBRTC_WINFILESYSTEM_H__ | 71 #endif // WEBRTC_WINFILESYSTEM_H__ |
OLD | NEW |