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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 virtual std::string TempFilename(const Pathname &dir, | 148 virtual std::string TempFilename(const Pathname &dir, |
149 const std::string &prefix) = 0; | 149 const std::string &prefix) = 0; |
150 | 150 |
151 // Determines the size of the file indicated by path. | 151 // Determines the size of the file indicated by path. |
152 virtual bool GetFileSize(const Pathname& path, size_t* size) = 0; | 152 virtual bool GetFileSize(const Pathname& path, size_t* size) = 0; |
153 | 153 |
154 // Determines a timestamp associated with the file indicated by path. | 154 // Determines a timestamp associated with the file indicated by path. |
155 virtual bool GetFileTime(const Pathname& path, FileTimeType which, | 155 virtual bool GetFileTime(const Pathname& path, FileTimeType which, |
156 time_t* time) = 0; | 156 time_t* time) = 0; |
157 | 157 |
158 // Get a folder that is unique to the current application, which is suitable | |
159 // for sharing data between executions of the app. If the per_user arg is | |
160 // true, the folder is also specific to the current user. | |
161 virtual bool GetAppDataFolder(Pathname* path, bool per_user) = 0; | |
162 | |
163 // Get a temporary folder that is unique to the current user and application. | 158 // Get a temporary folder that is unique to the current user and application. |
164 // TODO: Re-evaluate the goals of this function. We probably just need any | 159 // TODO: Re-evaluate the goals of this function. We probably just need any |
165 // directory that won't collide with another existing directory, and which | 160 // directory that won't collide with another existing directory, and which |
166 // will be cleaned up when the program exits. | 161 // will be cleaned up when the program exits. |
167 virtual bool GetAppTempFolder(Pathname* path) = 0; | 162 virtual bool GetAppTempFolder(Pathname* path) = 0; |
168 | 163 |
169 virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) = 0; | |
170 | |
171 // Note: These might go into some shared config section later, but they're | 164 // Note: These might go into some shared config section later, but they're |
172 // used by some methods in this interface, so we're leaving them here for now. | 165 // used by some methods in this interface, so we're leaving them here for now. |
173 void SetOrganizationName(const std::string& organization) { | 166 void SetOrganizationName(const std::string& organization) { |
174 organization_name_ = organization; | 167 organization_name_ = organization; |
175 } | 168 } |
176 void GetOrganizationName(std::string* organization) { | 169 void GetOrganizationName(std::string* organization) { |
177 RTC_DCHECK(organization); | 170 RTC_DCHECK(organization); |
178 *organization = organization_name_; | 171 *organization = organization_name_; |
179 } | 172 } |
180 void SetApplicationName(const std::string& application) { | 173 void SetApplicationName(const std::string& application) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 262 |
270 static bool GetFileSize(const Pathname& path, size_t* size) { | 263 static bool GetFileSize(const Pathname& path, size_t* size) { |
271 return EnsureDefaultFilesystem()->GetFileSize(path, size); | 264 return EnsureDefaultFilesystem()->GetFileSize(path, size); |
272 } | 265 } |
273 | 266 |
274 static bool GetFileTime(const Pathname& path, FileTimeType which, | 267 static bool GetFileTime(const Pathname& path, FileTimeType which, |
275 time_t* time) { | 268 time_t* time) { |
276 return EnsureDefaultFilesystem()->GetFileTime(path, which, time); | 269 return EnsureDefaultFilesystem()->GetFileTime(path, which, time); |
277 } | 270 } |
278 | 271 |
279 static bool GetAppDataFolder(Pathname* path, bool per_user) { | |
280 return EnsureDefaultFilesystem()->GetAppDataFolder(path, per_user); | |
281 } | |
282 | |
283 static bool GetAppTempFolder(Pathname* path) { | 272 static bool GetAppTempFolder(Pathname* path) { |
284 return EnsureDefaultFilesystem()->GetAppTempFolder(path); | 273 return EnsureDefaultFilesystem()->GetAppTempFolder(path); |
285 } | 274 } |
286 | 275 |
287 static bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) { | |
288 return EnsureDefaultFilesystem()->GetDiskFreeSpace(path, freebytes); | |
289 } | |
290 | |
291 static void SetOrganizationName(const std::string& organization) { | 276 static void SetOrganizationName(const std::string& organization) { |
292 EnsureDefaultFilesystem()->SetOrganizationName(organization); | 277 EnsureDefaultFilesystem()->SetOrganizationName(organization); |
293 } | 278 } |
294 | 279 |
295 static void GetOrganizationName(std::string* organization) { | 280 static void GetOrganizationName(std::string* organization) { |
296 EnsureDefaultFilesystem()->GetOrganizationName(organization); | 281 EnsureDefaultFilesystem()->GetOrganizationName(organization); |
297 } | 282 } |
298 | 283 |
299 static void SetApplicationName(const std::string& application) { | 284 static void SetApplicationName(const std::string& application) { |
300 EnsureDefaultFilesystem()->SetApplicationName(application); | 285 EnsureDefaultFilesystem()->SetApplicationName(application); |
(...skipping 19 matching lines...) Expand all Loading... |
320 Filesystem::set_default_filesystem(old_fs_); | 305 Filesystem::set_default_filesystem(old_fs_); |
321 } | 306 } |
322 private: | 307 private: |
323 FilesystemInterface* old_fs_; | 308 FilesystemInterface* old_fs_; |
324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); | 309 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); |
325 }; | 310 }; |
326 | 311 |
327 } // namespace rtc | 312 } // namespace rtc |
328 | 313 |
329 #endif // WEBRTC_BASE_FILEUTILS_H_ | 314 #endif // WEBRTC_BASE_FILEUTILS_H_ |
OLD | NEW |