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 #include "webrtc/base/fileutils.h" | 11 #include "webrtc/base/fileutils.h" |
12 | 12 |
13 #include "webrtc/base/arraysize.h" | 13 #include "webrtc/base/arraysize.h" |
14 #include "webrtc/base/checks.h" | 14 #include "webrtc/base/checks.h" |
15 #include "webrtc/base/pathutils.h" | 15 #include "webrtc/base/pathutils.h" |
16 #include "webrtc/base/stringutils.h" | 16 #include "webrtc/base/stringutils.h" |
17 #include "webrtc/base/stream.h" | |
18 | 17 |
19 #if defined(WEBRTC_WIN) | 18 #if defined(WEBRTC_WIN) |
20 #include "webrtc/base/win32filesystem.h" | 19 #include "webrtc/base/win32filesystem.h" |
21 #else | 20 #else |
22 #include "webrtc/base/unixfilesystem.h" | 21 #include "webrtc/base/unixfilesystem.h" |
23 #endif | 22 #endif |
24 | 23 |
25 #if !defined(WEBRTC_WIN) | 24 #if !defined(WEBRTC_WIN) |
26 #define MAX_PATH 260 | 25 #define MAX_PATH 260 |
27 #endif | 26 #endif |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 128 } |
130 return default_filesystem_; | 129 return default_filesystem_; |
131 } | 130 } |
132 | 131 |
133 DirectoryIterator* FilesystemInterface::IterateDirectory() { | 132 DirectoryIterator* FilesystemInterface::IterateDirectory() { |
134 return new DirectoryIterator(); | 133 return new DirectoryIterator(); |
135 } | 134 } |
136 | 135 |
137 bool FilesystemInterface::DeleteFolderContents(const Pathname &folder) { | 136 bool FilesystemInterface::DeleteFolderContents(const Pathname &folder) { |
138 bool success = true; | 137 bool success = true; |
139 VERIFY(IsFolder(folder)); | 138 RTC_CHECK(IsFolder(folder)); |
140 DirectoryIterator *di = IterateDirectory(); | 139 DirectoryIterator *di = IterateDirectory(); |
141 if (!di) | 140 if (!di) |
142 return false; | 141 return false; |
143 if (di->Iterate(folder)) { | 142 if (di->Iterate(folder)) { |
144 do { | 143 do { |
145 if (di->Name() == "." || di->Name() == "..") | 144 if (di->Name() == "." || di->Name() == "..") |
146 continue; | 145 continue; |
147 Pathname subdir; | 146 Pathname subdir; |
148 subdir.SetFolder(folder.pathname()); | 147 subdir.SetFolder(folder.pathname()); |
149 if (di->IsDirectory()) { | 148 if (di->IsDirectory()) { |
(...skipping 11 matching lines...) Expand all Loading... |
161 } | 160 } |
162 delete di; | 161 delete di; |
163 return success; | 162 return success; |
164 } | 163 } |
165 | 164 |
166 bool FilesystemInterface::DeleteFolderAndContents(const Pathname& folder) { | 165 bool FilesystemInterface::DeleteFolderAndContents(const Pathname& folder) { |
167 return DeleteFolderContents(folder) && DeleteEmptyFolder(folder); | 166 return DeleteFolderContents(folder) && DeleteEmptyFolder(folder); |
168 } | 167 } |
169 | 168 |
170 } // namespace rtc | 169 } // namespace rtc |
OLD | NEW |