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 21 matching lines...) Expand all Loading... |
32 // SetApp*Folder() APIs once external users stop using them. | 32 // SetApp*Folder() APIs once external users stop using them. |
33 static void SetAppDataFolder(const std::string& folder); | 33 static void SetAppDataFolder(const std::string& folder); |
34 static void SetAppTempFolder(const std::string& folder); | 34 static void SetAppTempFolder(const std::string& folder); |
35 #endif | 35 #endif |
36 | 36 |
37 // Opens a file. Returns an open StreamInterface if function succeeds. | 37 // Opens a file. Returns an open StreamInterface if function succeeds. |
38 // Otherwise, returns NULL. | 38 // Otherwise, returns NULL. |
39 FileStream* OpenFile(const Pathname& filename, | 39 FileStream* OpenFile(const Pathname& filename, |
40 const std::string& mode) override; | 40 const std::string& mode) override; |
41 | 41 |
42 // Atomically creates an empty file accessible only to the current user if one | |
43 // does not already exist at the given path, otherwise fails. | |
44 bool CreatePrivateFile(const Pathname& filename) override; | |
45 | |
46 // This will attempt to delete the file located at filename. | 42 // This will attempt to delete the file located at filename. |
47 // It will fail with VERIY if you pass it a non-existant file, or a directory. | 43 // It will fail with VERIY if you pass it a non-existant file, or a directory. |
48 bool DeleteFile(const Pathname& filename) override; | 44 bool DeleteFile(const Pathname& filename) override; |
49 | 45 |
50 // This will attempt to delete the folder located at 'folder' | 46 // This will attempt to delete the folder located at 'folder' |
51 // It ASSERTs and returns false if you pass it a non-existant folder or a | 47 // It ASSERTs and returns false if you pass it a non-existant folder or a |
52 // plain file. | 48 // plain file. |
53 bool DeleteEmptyFolder(const Pathname& folder) override; | 49 bool DeleteEmptyFolder(const Pathname& folder) override; |
54 | 50 |
55 // Creates a directory. This will call itself recursively to create /foo/bar | 51 // Creates a directory. This will call itself recursively to create /foo/bar |
56 // even if /foo does not exist. All created directories are created with the | 52 // even if /foo does not exist. All created directories are created with the |
57 // given mode. | 53 // given mode. |
58 // Returns TRUE if function succeeds | 54 // Returns TRUE if function succeeds |
59 virtual bool CreateFolder(const Pathname &pathname, mode_t mode); | 55 virtual bool CreateFolder(const Pathname &pathname, mode_t mode); |
60 | 56 |
61 // As above, with mode = 0755. | 57 // As above, with mode = 0755. |
62 bool CreateFolder(const Pathname& pathname) override; | 58 bool CreateFolder(const Pathname& pathname) override; |
63 | 59 |
64 // This moves a file from old_path to new_path, where "file" can be a plain | 60 // This moves a file from old_path to new_path, where "file" can be a plain |
65 // file or directory, which will be moved recursively. | 61 // file or directory, which will be moved recursively. |
66 // Returns true if function succeeds. | 62 // Returns true if function succeeds. |
67 bool MoveFile(const Pathname& old_path, const Pathname& new_path) override; | 63 bool MoveFile(const Pathname& old_path, const Pathname& new_path) override; |
68 bool MoveFolder(const Pathname& old_path, const Pathname& new_path) override; | |
69 | 64 |
70 // This copies a file from old_path to _new_path where "file" can be a plain | 65 // This copies a file from old_path to _new_path where "file" can be a plain |
71 // file or directory, which will be copied recursively. | 66 // file or directory, which will be copied recursively. |
72 // Returns true if function succeeds | 67 // Returns true if function succeeds |
73 bool CopyFile(const Pathname& old_path, const Pathname& new_path) override; | 68 bool CopyFile(const Pathname& old_path, const Pathname& new_path) override; |
74 | 69 |
75 // Returns true if a pathname is a directory | 70 // Returns true if a pathname is a directory |
76 bool IsFolder(const Pathname& pathname) override; | 71 bool IsFolder(const Pathname& pathname) override; |
77 | 72 |
78 // Returns true if pathname represents a temporary location on the system. | 73 // Returns true if pathname represents a temporary location on the system. |
(...skipping 13 matching lines...) Expand all Loading... |
92 // automatically deleted when the program exists) | 87 // automatically deleted when the program exists) |
93 bool GetTemporaryFolder(Pathname& path, | 88 bool GetTemporaryFolder(Pathname& path, |
94 bool create, | 89 bool create, |
95 const std::string* append) override; | 90 const std::string* append) override; |
96 | 91 |
97 bool GetFileSize(const Pathname& path, size_t* size) override; | 92 bool GetFileSize(const Pathname& path, size_t* size) override; |
98 bool GetFileTime(const Pathname& path, | 93 bool GetFileTime(const Pathname& path, |
99 FileTimeType which, | 94 FileTimeType which, |
100 time_t* time) override; | 95 time_t* time) override; |
101 | 96 |
102 // Returns the path to the running application. | |
103 bool GetAppPathname(Pathname* path) override; | |
104 | |
105 bool GetAppDataFolder(Pathname* path, bool per_user) override; | 97 bool GetAppDataFolder(Pathname* path, bool per_user) override; |
106 | 98 |
107 // Get a temporary folder that is unique to the current user and application. | 99 // Get a temporary folder that is unique to the current user and application. |
108 bool GetAppTempFolder(Pathname* path) override; | 100 bool GetAppTempFolder(Pathname* path) override; |
109 | 101 |
110 bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) override; | 102 bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) override; |
111 | 103 |
112 // Returns the absolute path of the current directory. | |
113 Pathname GetCurrentDirectory() override; | |
114 | |
115 private: | 104 private: |
116 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) | 105 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) |
117 static char* provided_app_data_folder_; | 106 static char* provided_app_data_folder_; |
118 static char* provided_app_temp_folder_; | 107 static char* provided_app_temp_folder_; |
119 #else | 108 #else |
120 static char* app_temp_path_; | 109 static char* app_temp_path_; |
121 #endif | 110 #endif |
122 | 111 |
123 static char* CopyString(const std::string& str); | 112 static char* CopyString(const std::string& str); |
124 }; | 113 }; |
125 | 114 |
126 } // namespace rtc | 115 } // namespace rtc |
127 | 116 |
128 #endif // WEBRTC_BASE_UNIXFILESYSTEM_H_ | 117 #endif // WEBRTC_BASE_UNIXFILESYSTEM_H_ |
OLD | NEW |