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 // Opens a file. Returns an open StreamInterface if function succeeds. Otherwi
se, | 20 // Opens a file. Returns an open StreamInterface if function succeeds. |
21 // returns NULL. | 21 // Otherwise, returns null. |
22 virtual FileStream *OpenFile(const Pathname &filename, | 22 virtual FileStream *OpenFile(const Pathname &filename, |
23 const std::string &mode); | 23 const std::string &mode); |
24 | 24 |
25 // This will attempt to delete the path located at filename. | 25 // This will attempt to delete the path located at filename. |
26 // If the path points to a folder, it will fail with VERIFY | 26 // If the path points to a folder, it will fail with VERIFY |
27 virtual bool DeleteFile(const Pathname &filename); | 27 virtual bool DeleteFile(const Pathname &filename); |
28 | 28 |
29 // This will attempt to delete an empty folder. If the path does not point to | 29 // This will attempt to delete an empty folder. If the path does not point to |
30 // a folder, it fails with VERIFY. If the folder is not empty, it fails normal
ly | 30 // a folder, it fails with VERIFY. If the folder is not empty, it fails normal
ly |
31 virtual bool DeleteEmptyFolder(const Pathname &folder); | 31 virtual bool DeleteEmptyFolder(const Pathname &folder); |
(...skipping 22 matching lines...) Expand all Loading... |
54 // Returns true if pathname refers to no filesystem object, every parent | 54 // Returns true if pathname refers to no filesystem object, every parent |
55 // directory either exists, or is also absent. | 55 // directory either exists, or is also absent. |
56 virtual bool IsAbsent(const Pathname& pathname); | 56 virtual bool IsAbsent(const Pathname& pathname); |
57 | 57 |
58 // Returns true if pathname represents a temporary location on the system. | 58 // Returns true if pathname represents a temporary location on the system. |
59 virtual bool IsTemporaryPath(const Pathname& pathname); | 59 virtual bool IsTemporaryPath(const Pathname& pathname); |
60 | 60 |
61 // All of the following functions set pathname and return true if successful. | 61 // All of the following functions set pathname and return true if successful. |
62 // Returned paths always include a trailing backslash. | 62 // Returned paths always include a trailing backslash. |
63 // If create is true, the path will be recursively created. | 63 // If create is true, the path will be recursively created. |
64 // If append is non-NULL, it will be appended (and possibly created). | 64 // If append is non-null, it will be appended (and possibly created). |
65 | 65 |
66 virtual std::string TempFilename(const Pathname &dir, const std::string &prefi
x); | 66 virtual std::string TempFilename(const Pathname &dir, const std::string &prefi
x); |
67 | 67 |
68 virtual bool GetFileSize(const Pathname& path, size_t* size); | 68 virtual bool GetFileSize(const Pathname& path, size_t* size); |
69 virtual bool GetFileTime(const Pathname& path, FileTimeType which, | 69 virtual bool GetFileTime(const Pathname& path, FileTimeType which, |
70 time_t* time); | 70 time_t* time); |
71 | 71 |
72 // A folder appropriate for storing temporary files (Contents are | 72 // A folder appropriate for storing temporary files (Contents are |
73 // automatically deleted when the program exists) | 73 // automatically deleted when the program exists) |
74 virtual bool GetTemporaryFolder(Pathname &path, bool create, | 74 virtual bool GetTemporaryFolder(Pathname &path, bool create, |
75 const std::string *append); | 75 const std::string *append); |
76 | 76 |
77 // Get a temporary folder that is unique to the current user and application. | 77 // Get a temporary folder that is unique to the current user and application. |
78 virtual bool GetAppTempFolder(Pathname* path); | 78 virtual bool GetAppTempFolder(Pathname* path); |
79 | 79 |
80 private: | 80 private: |
81 // Returns the path to the running application. | 81 // Returns the path to the running application. |
82 bool GetAppPathname(Pathname* path); | 82 bool GetAppPathname(Pathname* path); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace rtc | 85 } // namespace rtc |
86 | 86 |
87 #endif // WEBRTC_WINFILESYSTEM_H__ | 87 #endif // WEBRTC_WINFILESYSTEM_H__ |
OLD | NEW |