| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The type of an entity on the file system, such as a file, directory, or link. | 8 * The type of an entity on the file system, such as a file, directory, or link. |
| 9 * | 9 * |
| 10 * These constants are used by the [FileSystemEntity] class | 10 * These constants are used by the [FileSystemEntity] class |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 if (result is OSError) { | 652 if (result is OSError) { |
| 653 throw new FileSystemException(msg, path, result); | 653 throw new FileSystemException(msg, path, result); |
| 654 } else if (result is ArgumentError) { | 654 } else if (result is ArgumentError) { |
| 655 throw result; | 655 throw result; |
| 656 } | 656 } |
| 657 } | 657 } |
| 658 | 658 |
| 659 static String _trimTrailingPathSeparators(String path) { | 659 static String _trimTrailingPathSeparators(String path) { |
| 660 // Don't handle argument errors here. | 660 // Don't handle argument errors here. |
| 661 if (path is! String) return path; | 661 if (path is! String) return path; |
| 662 if (Platform.operatingSystem == 'windows') { | 662 if (Platform.isWindows) { |
| 663 while (path.length > 1 && | 663 while (path.length > 1 && |
| 664 (path.endsWith(Platform.pathSeparator) || | 664 (path.endsWith(Platform.pathSeparator) || |
| 665 path.endsWith('/'))) { | 665 path.endsWith('/'))) { |
| 666 path = path.substring(0, path.length - 1); | 666 path = path.substring(0, path.length - 1); |
| 667 } | 667 } |
| 668 } else { | 668 } else { |
| 669 while (path.length > 1 && path.endsWith(Platform.pathSeparator)) { | 669 while (path.length > 1 && path.endsWith(Platform.pathSeparator)) { |
| 670 path = path.substring(0, path.length - 1); | 670 path = path.substring(0, path.length - 1); |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 return path; | 673 return path; |
| 674 } | 674 } |
| 675 | 675 |
| 676 static String _ensureTrailingPathSeparators(String path) { | 676 static String _ensureTrailingPathSeparators(String path) { |
| 677 // Don't handle argument errors here. | 677 // Don't handle argument errors here. |
| 678 if (path is! String) return path; | 678 if (path is! String) return path; |
| 679 if (path.isEmpty) path = '.'; | 679 if (path.isEmpty) path = '.'; |
| 680 if (Platform.operatingSystem == 'windows') { | 680 if (Platform.isWindows) { |
| 681 while (!path.endsWith(Platform.pathSeparator) && !path.endsWith('/')) { | 681 while (!path.endsWith(Platform.pathSeparator) && !path.endsWith('/')) { |
| 682 path = "$path${Platform.pathSeparator}"; | 682 path = "$path${Platform.pathSeparator}"; |
| 683 } | 683 } |
| 684 } else { | 684 } else { |
| 685 while (!path.endsWith(Platform.pathSeparator)) { | 685 while (!path.endsWith(Platform.pathSeparator)) { |
| 686 path = "$path${Platform.pathSeparator}"; | 686 path = "$path${Platform.pathSeparator}"; |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 return path; | 689 return path; |
| 690 } | 690 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 return buffer.toString(); | 806 return buffer.toString(); |
| 807 } | 807 } |
| 808 } | 808 } |
| 809 | 809 |
| 810 | 810 |
| 811 class _FileSystemWatcher { | 811 class _FileSystemWatcher { |
| 812 external static Stream<FileSystemEvent> watch( | 812 external static Stream<FileSystemEvent> watch( |
| 813 String path, int events, bool recursive); | 813 String path, int events, bool recursive); |
| 814 external static bool get isSupported; | 814 external static bool get isSupported; |
| 815 } | 815 } |
| OLD | NEW |