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

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

Issue 13370003: Fix a few bugs breaking the pub tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/tests/pub/descriptor/tar.dart » ('j') | 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';
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 /// Creates a temp directory whose name will be based on [dir] with a unique 118 /// Creates a temp directory whose name will be based on [dir] with a unique
119 /// suffix appended to it. If [dir] is not provided, a temp directory will be 119 /// suffix appended to it. If [dir] is not provided, a temp directory will be
120 /// created in a platform-dependent temporary location. Returns the path of the 120 /// created in a platform-dependent temporary location. Returns the path of the
121 /// created directory. 121 /// created directory.
122 String createTempDir([dir = '']) { 122 String createTempDir([dir = '']) {
123 var tempDir = new Directory(dir).createTempSync(); 123 var tempDir = new Directory(dir).createTempSync();
124 log.io("Created temp directory ${tempDir.path}"); 124 log.io("Created temp directory ${tempDir.path}");
125 return tempDir.path; 125 return tempDir.path;
126 } 126 }
127 127
128 // TODO(nweiz): rename includeHiddenFiles to includeHidden.
129 /// Lists the contents of [dir]. If [recursive] is `true`, lists subdirectory 128 /// Lists the contents of [dir]. If [recursive] is `true`, lists subdirectory
130 /// contents (defaults to `false`). If [includeHiddenFiles] is `true`, includes 129 /// contents (defaults to `false`). If [includeHidden] is `true`, includes files
131 /// files and directories beginning with `.` (defaults to `false`). 130 /// and directories beginning with `.` (defaults to `false`).
132 /// 131 ///
133 /// The returned paths are guaranteed to begin with [dir]. 132 /// The returned paths are guaranteed to begin with [dir].
134 List<String> listDir(String dir, {bool recursive: false, 133 List<String> listDir(String dir, {bool recursive: false,
135 bool includeHidden: false}) { 134 bool includeHidden: false}) {
136 List<String> doList(String dir, Set<String> listedDirectories) { 135 List<String> doList(String dir, Set<String> listedDirectories) {
137 var contents = <String>[]; 136 var contents = <String>[];
138 137
139 // Avoid recursive symlinks. 138 // Avoid recursive symlinks.
140 var resolvedPath = new File(dir).fullPathSync(); 139 var resolvedPath = new File(dir).fullPathSync();
141 if (listedDirectories.contains(resolvedPath)) return []; 140 if (listedDirectories.contains(resolvedPath)) return [];
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 const PubProcessResult(this.stdout, this.stderr, this.exitCode); 734 const PubProcessResult(this.stdout, this.stderr, this.exitCode);
736 735
737 bool get success => exitCode == 0; 736 bool get success => exitCode == 0;
738 } 737 }
739 738
740 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 739 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
741 Uri _getUri(uri) { 740 Uri _getUri(uri) {
742 if (uri is Uri) return uri; 741 if (uri is Uri) return uri;
743 return Uri.parse(uri); 742 return Uri.parse(uri);
744 } 743 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/descriptor/tar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698