OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
7 | 7 |
8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
9 | 9 |
10 #include <dirent.h> // NOLINT | 10 #include <dirent.h> // NOLINT |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return NO_RETRY_EXPECTED(closedir(dir_pointer)) == 0 && | 263 return NO_RETRY_EXPECTED(closedir(dir_pointer)) == 0 && |
264 NO_RETRY_EXPECTED(remove(path->AsString())) == 0; | 264 NO_RETRY_EXPECTED(remove(path->AsString())) == 0; |
265 } | 265 } |
266 bool ok = false; | 266 bool ok = false; |
267 switch (entry.d_type) { | 267 switch (entry.d_type) { |
268 case DT_DIR: | 268 case DT_DIR: |
269 ok = DeleteDir(entry.d_name, path); | 269 ok = DeleteDir(entry.d_name, path); |
270 break; | 270 break; |
271 case DT_REG: | 271 case DT_REG: |
272 case DT_LNK: | 272 case DT_LNK: |
| 273 case DT_SOCK: |
273 // Treat all links as files. This will delete the link which | 274 // Treat all links as files. This will delete the link which |
274 // is what we want no matter if the link target is a file or a | 275 // is what we want no matter if the link target is a file or a |
275 // directory. | 276 // directory. |
276 ok = DeleteFile(entry.d_name, path); | 277 ok = DeleteFile(entry.d_name, path); |
277 break; | 278 break; |
278 case DT_UNKNOWN: { | 279 case DT_UNKNOWN: { |
279 if (!path->Add(entry.d_name)) { | 280 if (!path->Add(entry.d_name)) { |
280 break; | 281 break; |
281 } | 282 } |
282 // On some file systems the entry type is not determined by | 283 // On some file systems the entry type is not determined by |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 bool Directory::Rename(const char* path, const char* new_path) { | 437 bool Directory::Rename(const char* path, const char* new_path) { |
437 ExistsResult exists = Exists(path); | 438 ExistsResult exists = Exists(path); |
438 if (exists != EXISTS) return false; | 439 if (exists != EXISTS) return false; |
439 return NO_RETRY_EXPECTED(rename(path, new_path)) == 0; | 440 return NO_RETRY_EXPECTED(rename(path, new_path)) == 0; |
440 } | 441 } |
441 | 442 |
442 } // namespace bin | 443 } // namespace bin |
443 } // namespace dart | 444 } // namespace dart |
444 | 445 |
445 #endif // defined(TARGET_OS_LINUX) | 446 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |