Chromium Code Reviews| Index: utils/pub/io.dart |
| diff --git a/utils/pub/io.dart b/utils/pub/io.dart |
| index c034ff13df318f5b28d978920786c8a210344010..68b064874ffed1fdbecb988f3c373cae2c01b532 100644 |
| --- a/utils/pub/io.dart |
| +++ b/utils/pub/io.dart |
| @@ -27,7 +27,7 @@ void printError(value) { |
| * [File] objects. |
| */ |
| String join(part1, [part2, part3, part4]) { |
| - final parts = _getPath(part1).split('/'); |
| + final parts = _getPath(part1).replaceAll('\\', '/').split('/'); |
|
nweiz
2012/07/30 23:03:39
It feels like maybe this should be part of _getPat
Bob Nystrom
2012/07/30 23:42:33
I'm hesitant to normalize paths eagerly really ear
|
| for (final part in [part2, part3, part4]) { |
| if (part == null) continue; |
| @@ -152,20 +152,21 @@ Future<Directory> ensureDir(path) { |
| return dirExists(path).chain((exists) { |
| if (exists) return new Future.immediate(new Directory(path)); |
| - return ensureDir(dirname(path)); |
| - }).chain((_) { |
| - var completer = new Completer<Directory>(); |
| - var future = createDir(path); |
| - future.handleException((error) { |
| - if (error is! DirectoryIOException) return false; |
| - // Error 17 means the directory already exists. |
| - if (error.osError.errorCode != 17) return false; |
| - |
| - completer.complete(_getDirectory(path)); |
| - return true; |
| + return ensureDir(dirname(path)).chain((p) { |
|
nweiz
2012/07/30 23:03:39
I don't understand why you've named this variable,
Bob Nystrom
2012/07/30 23:42:33
The "p" is leftover debug code. Removed.
The nest
|
| + var completer = new Completer<Directory>(); |
| + var future = createDir(path); |
| + future.handleException((error) { |
| + if (error is! DirectoryIOException) return false; |
| + // Error 17 means the directory already exists (or 183 on Windows). |
| + if (error.osError.errorCode != 17 && |
| + error.osError.errorCode != 183) return false; |
| + |
| + completer.complete(_getDirectory(path)); |
| + return true; |
| + }); |
| + future.then(completer.complete); |
| + return completer.future; |
| }); |
| - future.then(completer.complete); |
| - return completer.future; |
| }); |
| } |