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_RTC_BASE_UNIXFILESYSTEM_H_ | 11 #ifndef WEBRTC_RTC_BASE_UNIXFILESYSTEM_H_ |
12 #define WEBRTC_RTC_BASE_UNIXFILESYSTEM_H_ | 12 #define WEBRTC_RTC_BASE_UNIXFILESYSTEM_H_ |
13 | 13 |
14 #include <sys/types.h> | 14 #include <sys/types.h> |
15 | 15 |
16 #include "webrtc/rtc_base/fileutils.h" | 16 #include "webrtc/rtc_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 // This will attempt to delete the file located at filename. | 25 // This will attempt to delete the file located at filename. |
26 // It will fail with VERIY if you pass it a non-existant file, or a directory. | 26 // It will fail with VERIY if you pass it a non-existant file, or a directory. |
27 bool DeleteFile(const Pathname& filename) override; | 27 bool DeleteFile(const Pathname& filename) override; |
28 | 28 |
29 // Creates a directory. This will call itself recursively to create /foo/bar | |
30 // even if /foo does not exist. All created directories are created with the | |
31 // given mode. | |
32 // Returns TRUE if function succeeds | |
33 virtual bool CreateFolder(const Pathname &pathname, mode_t mode); | |
34 | |
35 // As above, with mode = 0755. | |
36 bool CreateFolder(const Pathname& pathname) override; | |
37 | |
38 // This moves a file from old_path to new_path, where "file" can be a plain | 29 // This moves a file from old_path to new_path, where "file" can be a plain |
39 // file or directory, which will be moved recursively. | 30 // file or directory, which will be moved recursively. |
40 // Returns true if function succeeds. | 31 // Returns true if function succeeds. |
41 bool MoveFile(const Pathname& old_path, const Pathname& new_path) override; | 32 bool MoveFile(const Pathname& old_path, const Pathname& new_path) override; |
42 | 33 |
43 // Returns true if a pathname is a directory | 34 // Returns true if a pathname is a directory |
44 bool IsFolder(const Pathname& pathname) override; | 35 bool IsFolder(const Pathname& pathname) override; |
45 | 36 |
46 // Returns true of pathname represents an existing file | 37 // Returns true of pathname represents an existing file |
47 bool IsFile(const Pathname& pathname) override; | 38 bool IsFile(const Pathname& pathname) override; |
(...skipping 10 matching lines...) Expand all Loading... |
58 #else | 49 #else |
59 static char* app_temp_path_; | 50 static char* app_temp_path_; |
60 #endif | 51 #endif |
61 | 52 |
62 static char* CopyString(const std::string& str); | 53 static char* CopyString(const std::string& str); |
63 }; | 54 }; |
64 | 55 |
65 } // namespace rtc | 56 } // namespace rtc |
66 | 57 |
67 #endif // WEBRTC_RTC_BASE_UNIXFILESYSTEM_H_ | 58 #endif // WEBRTC_RTC_BASE_UNIXFILESYSTEM_H_ |
OLD | NEW |