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_UNIXFILESYSTEM_H_ | 11 #ifndef WEBRTC_BASE_UNIXFILESYSTEM_H_ |
12 #define WEBRTC_BASE_UNIXFILESYSTEM_H_ | 12 #define WEBRTC_BASE_UNIXFILESYSTEM_H_ |
13 | 13 |
14 #include <sys/types.h> | 14 #include <sys/types.h> |
15 | 15 |
16 #include "webrtc/base/fileutils.h" | 16 #include "webrtc/base/fileutils.h" |
17 | 17 |
18 namespace rtc { | 18 namespace rtc { |
19 | 19 |
20 class UnixFilesystem : public FilesystemInterface { | 20 class UnixFilesystem : public FilesystemInterface { |
21 public: | 21 public: |
22 UnixFilesystem(); | 22 UnixFilesystem(); |
23 ~UnixFilesystem() override; | 23 ~UnixFilesystem() override; |
24 | 24 |
25 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 25 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) |
26 // Android does not have a native code API to fetch the app data or temp | 26 // Android does not have a native code API to fetch the app data or temp |
27 // folders. That needs to be passed into this class from Java. Similarly, iOS | 27 // folders. That needs to be passed into this class from Java. Similarly, iOS |
28 // only supports an Objective-C API for fetching the folder locations, so that | 28 // only supports an Objective-C API for fetching the folder locations, so that |
29 // needs to be passed in here from Objective-C. Or at least that used to be | 29 // needs to be passed in here from Objective-C. Or at least that used to be |
30 // the case; now the ctor will do the work if necessary and possible. | 30 // the case; now the ctor will do the work if necessary and possible. |
31 // TODO(fischman): add an Android version that uses JNI and drop the | 31 // TODO(fischman): add an Android version that uses JNI and drop the |
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 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Get a temporary folder that is unique to the current user and application. | 107 // Get a temporary folder that is unique to the current user and application. |
108 bool GetAppTempFolder(Pathname* path) override; | 108 bool GetAppTempFolder(Pathname* path) override; |
109 | 109 |
110 bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) override; | 110 bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) override; |
111 | 111 |
112 // Returns the absolute path of the current directory. | 112 // Returns the absolute path of the current directory. |
113 Pathname GetCurrentDirectory() override; | 113 Pathname GetCurrentDirectory() override; |
114 | 114 |
115 private: | 115 private: |
116 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 116 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) |
117 static char* provided_app_data_folder_; | 117 static char* provided_app_data_folder_; |
118 static char* provided_app_temp_folder_; | 118 static char* provided_app_temp_folder_; |
119 #else | 119 #else |
120 static char* app_temp_path_; | 120 static char* app_temp_path_; |
121 #endif | 121 #endif |
122 | 122 |
123 static char* CopyString(const std::string& str); | 123 static char* CopyString(const std::string& str); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace rtc | 126 } // namespace rtc |
127 | 127 |
128 #endif // WEBRTC_BASE_UNIXFILESYSTEM_H_ | 128 #endif // WEBRTC_BASE_UNIXFILESYSTEM_H_ |
OLD | NEW |