| 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 /** | 5 /** |
| 6 * Helper functionality to make working with IO easier. | 6 * Helper functionality to make working with IO easier. |
| 7 */ | 7 */ |
| 8 library io; | 8 library io; |
| 9 | 9 |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| 11 import 'dart:isolate'; | 11 import 'dart:isolate'; |
| 12 import 'dart:uri'; | 12 import 'dart:uri'; |
| 13 | 13 |
| 14 import 'utils.dart'; | 14 import 'utils.dart'; |
| 15 | 15 |
| 16 bool _isGitInstalledCache; | 16 bool _isGitInstalledCache; |
| 17 | 17 |
| 18 /// The cached Git command. | 18 /// The cached Git command. |
| 19 String _gitCommandCache; | 19 String _gitCommandCache; |
| 20 | 20 |
| 21 /** Gets the current working directory. */ | 21 /** Gets the current working directory. */ |
| 22 String get workingDir => new File('.').fullPathSync(); | 22 String get workingDir => getFullPath('.'); |
| 23 | 23 |
| 24 const Pattern NEWLINE_PATTERN = const RegExp("\r\n?|\n\r?"); | 24 const Pattern NEWLINE_PATTERN = const RegExp("\r\n?|\n\r?"); |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Prints the given string to `stderr` on its own line. | 27 * Prints the given string to `stderr` on its own line. |
| 28 */ | 28 */ |
| 29 void printError(value) { | 29 void printError(value) { |
| 30 stderr.writeString(value.toString()); | 30 stderr.writeString(value.toString()); |
| 31 stderr.writeString('\n'); | 31 stderr.writeString('\n'); |
| 32 } | 32 } |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 | 642 |
| 643 Future<bool> _extractTarGzWindows(InputStream stream, String destination) { | 643 Future<bool> _extractTarGzWindows(InputStream stream, String destination) { |
| 644 // TODO(rnystrom): In the repo's history, there is an older implementation of | 644 // TODO(rnystrom): In the repo's history, there is an older implementation of |
| 645 // this that does everything in memory by piping streams directly together | 645 // this that does everything in memory by piping streams directly together |
| 646 // instead of writing out temp files. The code is simpler, but unfortunately, | 646 // instead of writing out temp files. The code is simpler, but unfortunately, |
| 647 // 7zip seems to periodically fail when we invoke it from Dart and tell it to | 647 // 7zip seems to periodically fail when we invoke it from Dart and tell it to |
| 648 // read from stdin instead of a file. Consider resurrecting that version if | 648 // read from stdin instead of a file. Consider resurrecting that version if |
| 649 // we can figure out why it fails. | 649 // we can figure out why it fails. |
| 650 | 650 |
| 651 // Find 7zip. | 651 // Find 7zip. |
| 652 var scriptPath = new File(new Options().script).fullPathSync(); | 652 var scriptPath = getFullPath(new Options().script); |
| 653 var scriptDir = new Path.fromNative(scriptPath).directoryPath; | 653 var scriptDir = new Path.fromNative(scriptPath).directoryPath; |
| 654 | 654 |
| 655 // Note: This line of code gets munged by create_sdk.py to be the correct | 655 // Note: This line of code gets munged by create_sdk.py to be the correct |
| 656 // relative path to 7zip in the SDK. | 656 // relative path to 7zip in the SDK. |
| 657 var pathTo7zip = '../../third_party/7zip/7za.exe'; | 657 var pathTo7zip = '../../third_party/7zip/7za.exe'; |
| 658 var command = scriptDir.append(pathTo7zip).canonicalize().toNativePath(); | 658 var command = scriptDir.append(pathTo7zip).canonicalize().toNativePath(); |
| 659 | 659 |
| 660 var tempDir; | 660 var tempDir; |
| 661 | 661 |
| 662 return createTempDir().chain((temp) { | 662 return createTempDir().chain((temp) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 return new Directory(entry); | 761 return new Directory(entry); |
| 762 } | 762 } |
| 763 | 763 |
| 764 /** | 764 /** |
| 765 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 765 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
| 766 */ | 766 */ |
| 767 Uri _getUri(uri) { | 767 Uri _getUri(uri) { |
| 768 if (uri is Uri) return uri; | 768 if (uri is Uri) return uri; |
| 769 return new Uri.fromString(uri); | 769 return new Uri.fromString(uri); |
| 770 } | 770 } |
| OLD | NEW |