Index: sdk/lib/io/directory_impl.dart |
diff --git a/sdk/lib/io/directory_impl.dart b/sdk/lib/io/directory_impl.dart |
index 288364868df2b194827bd594a157b9ecb1755f04..e269610d04d0b02497190ef394529d28e098063f 100644 |
--- a/sdk/lib/io/directory_impl.dart |
+++ b/sdk/lib/io/directory_impl.dart |
@@ -91,12 +91,11 @@ class _Directory extends FileSystemEntity implements Directory { |
} |
Future<Directory> createRecursively() { |
- var path = new _Path(this.path); |
var dirsToCreate = []; |
- var terminator = path.isAbsolute ? '/' : ''; |
- while (path.toString() != terminator) { |
- dirsToCreate.add(new Directory(path.toNativePath())); |
- path = path.directoryPath; |
+ var dir = this; |
+ while (dir.path != dir.parent.path) { |
+ dirsToCreate.add(dir); |
+ dir = dir.parent; |
} |
return _computeExistingIndex(dirsToCreate).then((index) { |
var future; |
@@ -128,14 +127,12 @@ class _Directory extends FileSystemEntity implements Directory { |
} |
void createRecursivelySync() { |
- var path = new _Path(this.path); |
+ var dir = this; |
var dirsToCreate = []; |
- var terminator = path.isAbsolute ? '/' : ''; |
- while (path.toString() != terminator) { |
- var dir = new Directory(path.toNativePath()); |
+ while (dir.path != dir.parent.path) { |
if (dir.existsSync()) break; |
dirsToCreate.add(dir); |
- path = path.directoryPath; |
+ dir = dir.parent; |
} |
for (var i = dirsToCreate.length - 1; i >= 0; i--) { |
dirsToCreate[i].createSync(); |