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'; |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 // exit codes). See issue 3657. | 778 // exit codes). See issue 3657. |
779 var stream = new ListInputStream(); | 779 var stream = new ListInputStream(); |
780 | 780 |
781 if (baseDir == null) baseDir = currentWorkingDir; | 781 if (baseDir == null) baseDir = currentWorkingDir; |
782 baseDir = getFullPath(baseDir); | 782 baseDir = getFullPath(baseDir); |
783 contents = contents.map((entry) { | 783 contents = contents.map((entry) { |
784 entry = getFullPath(entry); | 784 entry = getFullPath(entry); |
785 if (!isBeneath(entry, baseDir)) { | 785 if (!isBeneath(entry, baseDir)) { |
786 throw 'Entry $entry is not inside $baseDir.'; | 786 throw 'Entry $entry is not inside $baseDir.'; |
787 } | 787 } |
788 return new Path(entry).relativeTo(new Path(baseDir)).toNativePath(); | 788 return new Path.fromNative(entry).relativeTo(new Path.fromNative(baseDir)) |
| 789 .toNativePath(); |
789 }); | 790 }); |
790 | 791 |
791 if (Platform.operatingSystem != "windows") { | 792 if (Platform.operatingSystem != "windows") { |
792 var args = ["--create", "--gzip", "--directory", baseDir]; | 793 var args = ["--create", "--gzip", "--directory", baseDir]; |
793 args.addAll(contents.map(_getPath)); | 794 args.addAll(contents.map(_getPath)); |
794 // TODO(nweiz): It's possible that enough command-line arguments will make | 795 // TODO(nweiz): It's possible that enough command-line arguments will make |
795 // the process choke, so at some point we should save the arguments to a | 796 // the process choke, so at some point we should save the arguments to a |
796 // file and pass them in via --files-from for tar and -i@filename for 7zip. | 797 // file and pass them in via --files-from for tar and -i@filename for 7zip. |
797 startProcess("tar", args).then((process) { | 798 startProcess("tar", args).then((process) { |
798 pipeInputToInput(process.stdout, stream); | 799 pipeInputToInput(process.stdout, stream); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 return new Directory(entry); | 893 return new Directory(entry); |
893 } | 894 } |
894 | 895 |
895 /** | 896 /** |
896 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 897 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
897 */ | 898 */ |
898 Uri _getUri(uri) { | 899 Uri _getUri(uri) { |
899 if (uri is Uri) return uri; | 900 if (uri is Uri) return uri; |
900 return new Uri.fromString(uri); | 901 return new Uri.fromString(uri); |
901 } | 902 } |
OLD | NEW |