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

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

Issue 23889008: Move delete/deleteSync up to FileSystemEntity, with a shared documentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Style fixes. Created 7 years, 3 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 | « sdk/lib/io/file.dart ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index babac96f7fc1ae0b4242df664a653167964160d0..ba6b64279c3bfa5231912cb10b73dd69a7cfd554 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -295,7 +295,10 @@ class _File extends FileSystemEntity implements File {
throwIfError(result, "Cannot create file", path);
}
- Future<File> delete() {
+ Future<File> _delete({bool recursive: false}) {
+ if (recursive) {
+ return new Directory(path).delete(recursive: true).then((_) => this);
+ }
_ensureFileService();
List request = new List(2);
request[0] = _DELETE_REQUEST;
@@ -308,12 +311,15 @@ class _File extends FileSystemEntity implements File {
});
}
- external static _delete(String path);
+ external static _deleteNative(String path);
- external static _deleteLink(String path);
+ external static _deleteLinkNative(String path);
- void deleteSync() {
- var result = _delete(path);
+ void _deleteSync({bool recursive: false}) {
+ if (recursive) {
+ return new Directory(path).deleteSync(recursive: true);
+ }
+ var result = _deleteNative(path);
throwIfError(result, "Cannot delete file", path);
}
« no previous file with comments | « sdk/lib/io/file.dart ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698