| 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 class FileSystemEntityType { | 7 class FileSystemEntityType { |
| 8 static const FILE = const FileSystemEntityType._internal(0); | 8 static const FILE = const FileSystemEntityType._internal(0); |
| 9 static const DIRECTORY = const FileSystemEntityType._internal(1); | 9 static const DIRECTORY = const FileSystemEntityType._internal(1); |
| 10 static const LINK = const FileSystemEntityType._internal(2); | 10 static const LINK = const FileSystemEntityType._internal(2); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 static Future<int> _getTypeAsync(String path, bool followLinks) { | 46 static Future<int> _getTypeAsync(String path, bool followLinks) { |
| 47 // Get a new file service port for each request. We could also cache one. | 47 // Get a new file service port for each request. We could also cache one. |
| 48 var service = _FileUtils._newServicePort(); | 48 var service = _FileUtils._newServicePort(); |
| 49 List request = new List(3); | 49 List request = new List(3); |
| 50 request[0] = _TYPE_REQUEST; | 50 request[0] = _TYPE_REQUEST; |
| 51 request[1] = path; | 51 request[1] = path; |
| 52 request[2] = followLinks; | 52 request[2] = followLinks; |
| 53 return service.call(request).then((response) { | 53 return service.call(request).then((response) { |
| 54 if (_isErrorResponse(response)) { | 54 if (_isErrorResponse(response)) { |
| 55 throw _exceptionFromResponse(response, | 55 throw _exceptionFromResponse(response, |
| 56 "Error getting type of '$_path'"); | 56 "Error getting type of '$path'"); |
| 57 } | 57 } |
| 58 return response; | 58 return response; |
| 59 }); | 59 }); |
| 60 } | 60 } |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * Do two paths refer to the same object in the file system? | 63 * Do two paths refer to the same object in the file system? |
| 64 * Links are not identical to their targets, and two links | 64 * Links are not identical to their targets, and two links |
| 65 * are not identical just because they point to identical targets. | 65 * are not identical just because they point to identical targets. |
| 66 * Links in intermediate directories in the paths are followed, though. | 66 * Links in intermediate directories in the paths are followed, though. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 (_getTypeSync(path, true) == FileSystemEntityType.DIRECTORY._type); | 128 (_getTypeSync(path, true) == FileSystemEntityType.DIRECTORY._type); |
| 129 | 129 |
| 130 static _throwIfError(Object result, String msg) { | 130 static _throwIfError(Object result, String msg) { |
| 131 if (result is OSError) { | 131 if (result is OSError) { |
| 132 throw new FileIOException(msg, result); | 132 throw new FileIOException(msg, result); |
| 133 } else if (result is ArgumentError) { | 133 } else if (result is ArgumentError) { |
| 134 throw result; | 134 throw result; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 } | 137 } |
| OLD | NEW |