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

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

Issue 12995008: Work around issue 9360. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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) 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 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';
11 import 'dart:json'; 11 import 'dart:json';
12 import 'dart:uri'; 12 import 'dart:uri';
13 13
14 import '../../pkg/pathos/lib/path.dart' as path; 14 import '../../pkg/pathos/lib/path.dart' as path;
15 import '../../pkg/http/lib/http.dart' show ByteStream; 15 import '../../pkg/http/lib/http.dart' show ByteStream;
16 import 'error_group.dart'; 16 import 'error_group.dart';
17 import 'exit_codes.dart' as exit_codes; 17 import 'exit_codes.dart' as exit_codes;
18 import 'log.dart' as log; 18 import 'log.dart' as log;
19 import 'utils.dart'; 19 import 'utils.dart';
20 20
21 export '../../pkg/http/lib/http.dart' show ByteStream; 21 export '../../pkg/http/lib/http.dart' show ByteStream;
22 22
23 final NEWLINE_PATTERN = new RegExp("\r\n?|\n\r?"); 23 // TODO(nweiz): Replace this with `new RegExp("\r\n?|\n\r?")` when issue 9360 is
24 // fixed.
Bob Nystrom 2013/03/22 15:06:55 Will this break code on Windows? I thought we had
nweiz 2013/03/22 18:31:03 Hmm, I guess we do use it to split process output.
25 final NEWLINE_PATTERN = "\n";
24 26
25 /// Returns whether or not [entry] is nested somewhere within [dir]. This just 27 /// Returns whether or not [entry] is nested somewhere within [dir]. This just
26 /// performs a path comparison; it doesn't look at the actual filesystem. 28 /// performs a path comparison; it doesn't look at the actual filesystem.
27 bool isBeneath(String entry, String dir) { 29 bool isBeneath(String entry, String dir) {
28 var relative = path.relative(entry, from: dir); 30 var relative = path.relative(entry, from: dir);
29 return !path.isAbsolute(relative) && path.split(relative)[0] != '..'; 31 return !path.isAbsolute(relative) && path.split(relative)[0] != '..';
30 } 32 }
31 33
32 /// Determines if a file or directory exists at [path]. 34 /// Determines if a file or directory exists at [path].
33 bool entryExists(String path) => dirExists(path) || fileExists(path); 35 bool entryExists(String path) => dirExists(path) || fileExists(path);
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 const PubProcessResult(this.stdout, this.stderr, this.exitCode); 770 const PubProcessResult(this.stdout, this.stderr, this.exitCode);
769 771
770 bool get success => exitCode == 0; 772 bool get success => exitCode == 0;
771 } 773 }
772 774
773 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 775 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
774 Uri _getUri(uri) { 776 Uri _getUri(uri) {
775 if (uri is Uri) return uri; 777 if (uri is Uri) return uri;
776 return Uri.parse(uri); 778 return Uri.parse(uri);
777 } 779 }
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