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

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

Issue 11881032: Stop working around issue 7781 in Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « utils/pub/http.dart ('k') | utils/pub/oauth2.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) 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if (path == '.') return new Future.immediate(new Directory('.')); 182 if (path == '.') return new Future.immediate(new Directory('.'));
183 183
184 return dirExists(path).then((exists) { 184 return dirExists(path).then((exists) {
185 if (exists) { 185 if (exists) {
186 log.fine("Directory $path already exists."); 186 log.fine("Directory $path already exists.");
187 return new Future.immediate(new Directory(path)); 187 return new Future.immediate(new Directory(path));
188 } 188 }
189 189
190 return ensureDir(dirname(path)).then((_) { 190 return ensureDir(dirname(path)).then((_) {
191 return createDir(path).catchError((asyncError) { 191 return createDir(path).catchError((asyncError) {
192 var error = getRealError(asyncError); 192 if (asyncError.error is! DirectoryIOException) throw asyncError;
193 if (error is! DirectoryIOException) throw asyncError;
194 // Error 17 means the directory already exists (or 183 on Windows). 193 // Error 17 means the directory already exists (or 183 on Windows).
195 if (error.osError.errorCode == 17 || error.osError.errorCode == 183) { 194 if (asyncError.error.osError.errorCode == 17 ||
195 asyncError.error.osError.errorCode == 183) {
196 log.fine("Got 'already exists' error when creating directory."); 196 log.fine("Got 'already exists' error when creating directory.");
197 return _getDirectory(path); 197 return _getDirectory(path);
198 } 198 }
199 199
200 throw asyncError; 200 throw asyncError;
201 }); 201 });
202 }); 202 });
203 }); 203 });
204 } 204 }
205 205
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 Directory _getDirectory(entry) { 1028 Directory _getDirectory(entry) {
1029 if (entry is Directory) return entry; 1029 if (entry is Directory) return entry;
1030 return new Directory(entry); 1030 return new Directory(entry);
1031 } 1031 }
1032 1032
1033 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 1033 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
1034 Uri _getUri(uri) { 1034 Uri _getUri(uri) {
1035 if (uri is Uri) return uri; 1035 if (uri is Uri) return uri;
1036 return new Uri.fromString(uri); 1036 return new Uri.fromString(uri);
1037 } 1037 }
OLDNEW
« no previous file with comments | « utils/pub/http.dart ('k') | utils/pub/oauth2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698