| 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 /// Helper functionality to make working with IO easier. | 5 /// Helper functionality to make working with IO easier. |
| 6 library io; | 6 library io; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 /// Creates a new symlink that creates an alias from [from] to [to], both of | 309 /// Creates a new symlink that creates an alias from [from] to [to], both of |
| 310 /// which can be a [String], [File], or [Directory]. Returns a [Future] which | 310 /// which can be a [String], [File], or [Directory]. Returns a [Future] which |
| 311 /// completes to the symlink file (i.e. [to]). | 311 /// completes to the symlink file (i.e. [to]). |
| 312 /// | 312 /// |
| 313 /// Note that on Windows, only directories may be symlinked to. | 313 /// Note that on Windows, only directories may be symlinked to. |
| 314 Future<File> createSymlink(from, to) { | 314 Future<File> createSymlink(from, to) { |
| 315 from = _getPath(from); | 315 from = _getPath(from); |
| 316 to = _getPath(to); | 316 to = _getPath(to); |
| 317 | 317 |
| 318 log.fine("Create symlink $from -> $to."); | 318 log.fine("Creating symlink ($to is a symlink to $from)"); |
| 319 | 319 |
| 320 var command = 'ln'; | 320 var command = 'ln'; |
| 321 var args = ['-s', from, to]; | 321 var args = ['-s', from, to]; |
| 322 | 322 |
| 323 if (Platform.operatingSystem == 'windows') { | 323 if (Platform.operatingSystem == 'windows') { |
| 324 // Call mklink on Windows to create an NTFS junction point. Only works on | 324 // Call mklink on Windows to create an NTFS junction point. Only works on |
| 325 // Vista or later. (Junction points are available earlier, but the "mklink" | 325 // Vista or later. (Junction points are available earlier, but the "mklink" |
| 326 // command is not.) I'm using a junction point (/j) here instead of a soft | 326 // command is not.) I'm using a junction point (/j) here instead of a soft |
| 327 // link (/d) because the latter requires some privilege shenanigans that | 327 // link (/d) because the latter requires some privilege shenanigans that |
| 328 // I'm not sure how to specify from the command line. | 328 // I'm not sure how to specify from the command line. |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 Directory _getDirectory(entry) { | 941 Directory _getDirectory(entry) { |
| 942 if (entry is Directory) return entry; | 942 if (entry is Directory) return entry; |
| 943 return new Directory(entry); | 943 return new Directory(entry); |
| 944 } | 944 } |
| 945 | 945 |
| 946 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 946 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
| 947 Uri _getUri(uri) { | 947 Uri _getUri(uri) { |
| 948 if (uri is Uri) return uri; | 948 if (uri is Uri) return uri; |
| 949 return Uri.parse(uri); | 949 return Uri.parse(uri); |
| 950 } | 950 } |
| OLD | NEW |