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

Unified Diff: sdk/lib/io/directory_impl.dart

Issue 25421003: dart:io | Remove deprecated _Path library, and use FileSystemEntity.parent for recursive Directory.… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | sdk/lib/io/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698