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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 bool UnixFilesystem::DeleteFile(const Pathname &filename) { | 126 bool UnixFilesystem::DeleteFile(const Pathname &filename) { |
127 LOG(LS_INFO) << "Deleting file:" << filename.pathname(); | 127 LOG(LS_INFO) << "Deleting file:" << filename.pathname(); |
128 | 128 |
129 if (!IsFile(filename)) { | 129 if (!IsFile(filename)) { |
130 RTC_DCHECK(IsFile(filename)); | 130 RTC_DCHECK(IsFile(filename)); |
131 return false; | 131 return false; |
132 } | 132 } |
133 return ::unlink(filename.pathname().c_str()) == 0; | 133 return ::unlink(filename.pathname().c_str()) == 0; |
134 } | 134 } |
135 | 135 |
136 bool UnixFilesystem::DeleteEmptyFolder(const Pathname &folder) { | |
137 LOG(LS_INFO) << "Deleting folder" << folder.pathname(); | |
138 | |
139 if (!IsFolder(folder)) { | |
140 RTC_DCHECK(IsFolder(folder)); | |
141 return false; | |
142 } | |
143 std::string no_slash(folder.pathname(), 0, folder.pathname().length()-1); | |
144 return ::rmdir(no_slash.c_str()) == 0; | |
145 } | |
146 | |
147 bool UnixFilesystem::GetTemporaryFolder(Pathname &pathname, bool create, | 136 bool UnixFilesystem::GetTemporaryFolder(Pathname &pathname, bool create, |
148 const std::string *append) { | 137 const std::string *append) { |
149 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) | 138 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) |
150 RTC_DCHECK(provided_app_temp_folder_ != nullptr); | 139 RTC_DCHECK(provided_app_temp_folder_ != nullptr); |
151 pathname.SetPathname(provided_app_temp_folder_, ""); | 140 pathname.SetPathname(provided_app_temp_folder_, ""); |
152 #else | 141 #else |
153 if (const char* tmpdir = getenv("TMPDIR")) { | 142 if (const char* tmpdir = getenv("TMPDIR")) { |
154 pathname.SetPathname(tmpdir, ""); | 143 pathname.SetPathname(tmpdir, ""); |
155 } else if (const char* tmp = getenv("TMP")) { | 144 } else if (const char* tmp = getenv("TMP")) { |
156 pathname.SetPathname(tmp, ""); | 145 pathname.SetPathname(tmp, ""); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 253 |
265 } // namespace rtc | 254 } // namespace rtc |
266 | 255 |
267 #if defined(__native_client__) | 256 #if defined(__native_client__) |
268 extern "C" int __attribute__((weak)) | 257 extern "C" int __attribute__((weak)) |
269 link(const char* oldpath, const char* newpath) { | 258 link(const char* oldpath, const char* newpath) { |
270 errno = EACCES; | 259 errno = EACCES; |
271 return -1; | 260 return -1; |
272 } | 261 } |
273 #endif | 262 #endif |
OLD | NEW |