| 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 * [Link] objects are references to filesystem links. | 8 * [Link] objects are references to filesystem links. |
| 9 * | 9 * |
| 10 */ | 10 */ |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 final String path; | 121 final String path; |
| 122 | 122 |
| 123 SendPort _fileService; | 123 SendPort _fileService; |
| 124 | 124 |
| 125 _Link(String this.path); | 125 _Link(String this.path); |
| 126 | 126 |
| 127 _Link.fromPath(Path inputPath) : path = inputPath.toNativePath(); | 127 _Link.fromPath(Path inputPath) : path = inputPath.toNativePath(); |
| 128 | 128 |
| 129 String toString() => "Link: '$path'"; | 129 String toString() => "Link: '$path'"; |
| 130 | 130 |
| 131 Future<bool> exists() { | 131 Future<bool> exists() => FileSystemEntity.isLink(path); |
| 132 // TODO(whesse): Replace with asynchronous version. | |
| 133 return new Future.value(existsSync()); | |
| 134 } | |
| 135 | 132 |
| 136 bool existsSync() => FileSystemEntity.isLinkSync(path); | 133 bool existsSync() => FileSystemEntity.isLinkSync(path); |
| 137 | 134 |
| 138 Future<Link> create(String target) { | 135 Future<Link> create(String target) { |
| 139 _ensureFileService(); | 136 _ensureFileService(); |
| 140 if (Platform.operatingSystem == 'windows') { | 137 if (Platform.operatingSystem == 'windows') { |
| 141 target = _makeWindowsLinkTarget(target); | 138 target = _makeWindowsLinkTarget(target); |
| 142 } | 139 } |
| 143 List request = new List(3); | 140 List request = new List(3); |
| 144 request[0] = _CREATE_LINK_REQUEST; | 141 request[0] = _CREATE_LINK_REQUEST; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 if (path != null) { | 272 if (path != null) { |
| 276 sb.write(", path = $path"); | 273 sb.write(", path = $path"); |
| 277 } | 274 } |
| 278 } | 275 } |
| 279 return sb.toString(); | 276 return sb.toString(); |
| 280 } | 277 } |
| 281 final String message; | 278 final String message; |
| 282 final String path; | 279 final String path; |
| 283 final OSError osError; | 280 final OSError osError; |
| 284 } | 281 } |
| OLD | NEW |