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

Side by Side Diff: utils/pub/io.dart

Issue 12261050: Fix pub on windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« 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) 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ..closeSync(); 74 ..closeSync();
75 log.fine("Wrote text file $file."); 75 log.fine("Wrote text file $file.");
76 return file; 76 return file;
77 } 77 }
78 78
79 /// Writes [stream] to a new file at path [file]. Will replace any file already 79 /// Writes [stream] to a new file at path [file]. Will replace any file already
80 /// at that path. Completes when the file is done being written. 80 /// at that path. Completes when the file is done being written.
81 Future<String> createFileFromStream(Stream<List<int>> stream, String file) { 81 Future<String> createFileFromStream(Stream<List<int>> stream, String file) {
82 log.io("Creating $file from stream."); 82 log.io("Creating $file from stream.");
83 83
84 var stream = new File(file).openOutputStream(); 84 var outputStream = new File(file).openOutputStream();
85 return stream.pipe(wrapOutputStream(stream)).then((_) { 85 return stream.pipe(wrapOutputStream(outputStream)).then((_) {
86 log.fine("Created $file from stream."); 86 log.fine("Created $file from stream.");
87 return file; 87 return file;
88 }); 88 });
89 } 89 }
90 90
91 /// Creates a directory [dir]. 91 /// Creates a directory [dir].
92 String createDir(String dir) { 92 String createDir(String dir) {
93 new Directory(dir).createSync(); 93 new Directory(dir).createSync();
94 return dir; 94 return dir;
95 } 95 }
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 const PubProcessResult(this.stdout, this.stderr, this.exitCode); 860 const PubProcessResult(this.stdout, this.stderr, this.exitCode);
861 861
862 bool get success => exitCode == 0; 862 bool get success => exitCode == 0;
863 } 863 }
864 864
865 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 865 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
866 Uri _getUri(uri) { 866 Uri _getUri(uri) {
867 if (uri is Uri) return uri; 867 if (uri is Uri) return uri;
868 return Uri.parse(uri); 868 return Uri.parse(uri);
869 } 869 }
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