Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: lib/src/io.dart

Issue 1920433002: Create tar files in a cross-platform format. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// Helper functionality to make working with IO easier. 5 /// Helper functionality to make working with IO easier.
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 contents = contents.map((entry) { 997 contents = contents.map((entry) {
998 entry = path.absolute(entry); 998 entry = path.absolute(entry);
999 if (!path.isWithin(baseDir, entry)) { 999 if (!path.isWithin(baseDir, entry)) {
1000 throw new ArgumentError('Entry $entry is not inside $baseDir.'); 1000 throw new ArgumentError('Entry $entry is not inside $baseDir.');
1001 } 1001 }
1002 return path.relative(entry, from: baseDir); 1002 return path.relative(entry, from: baseDir);
1003 }).toList(); 1003 }).toList();
1004 1004
1005 if (Platform.operatingSystem != "windows") { 1005 if (Platform.operatingSystem != "windows") {
1006 var args = [ 1006 var args = [
1007 // ustar is the most recent tar format that's compatible across all
1008 // OSes.
1009 "--format=ustar",
1007 "--create", 1010 "--create",
1008 "--gzip", 1011 "--gzip",
1009 "--directory", 1012 "--directory",
1010 baseDir, 1013 baseDir,
1011 "--files-from", 1014 "--files-from",
1012 "/dev/stdin" 1015 "/dev/stdin"
1013 ]; 1016 ];
1014 1017
1015 var process = await startProcess("tar", args); 1018 var process = await startProcess("tar", args);
1016 process.stdin.add(UTF8.encode(contents.join("\n"))); 1019 process.stdin.add(UTF8.encode(contents.join("\n")));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 1066
1064 // TODO(rnystrom): Remove this and change to returning one string. 1067 // TODO(rnystrom): Remove this and change to returning one string.
1065 static List<String> _toLines(String output) { 1068 static List<String> _toLines(String output) {
1066 var lines = splitLines(output); 1069 var lines = splitLines(output);
1067 if (!lines.isEmpty && lines.last == "") lines.removeLast(); 1070 if (!lines.isEmpty && lines.last == "") lines.removeLast();
1068 return lines; 1071 return lines;
1069 } 1072 }
1070 1073
1071 bool get success => exitCode == exit_codes.SUCCESS; 1074 bool get success => exitCode == exit_codes.SUCCESS;
1072 } 1075 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698