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

Side by Side Diff: runtime/bin/directory_impl.dart

Issue 8509002: Revert "Post on the error handler in the Directory API when errors are encountered." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « no previous file | runtime/bin/directory_posix.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 5
6 class _DirectoryListingIsolate extends Isolate { 6 class _DirectoryListingIsolate extends Isolate {
7 7
8 _DirectoryListingIsolate() : super.heavy(); 8 _DirectoryListingIsolate() : super.heavy();
9 9
10 void main() { 10 void main() {
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 31
32 class _Directory implements Directory { 32 class _Directory implements Directory {
33 33
34 _Directory(String this._path); 34 _Directory(String this._path);
35 35
36 bool existsSync() { 36 bool existsSync() {
37 int exists = _exists(_path); 37 int exists = _exists(_path);
38 if (exists < 0) { 38 if (exists < 0) {
39 // TODO(ager): Supply a better error message.
39 throw new DirectoryException("Diretory exists test failed: $_path"); 40 throw new DirectoryException("Diretory exists test failed: $_path");
40 } 41 }
41 return (exists == 1); 42 return (exists == 1);
42 } 43 }
43 44
44 void createSync() { 45 void createSync() {
45 if (!_create(_path)) { 46 if (!_create(_path)) {
47 // TODO(ager): Supply a better error message.
46 throw new DirectoryException("Directory creation failed: $_path"); 48 throw new DirectoryException("Directory creation failed: $_path");
47 } 49 }
48 } 50 }
49 51
50 void deleteSync() { 52 void deleteSync() {
51 if (!_delete(_path)) { 53 if (!_delete(_path)) {
54 // TODO(ager): Supply a better error message.
52 throw new DirectoryException("Directory deletion failed: $_path"); 55 throw new DirectoryException("Directory deletion failed: $_path");
53 } 56 }
54 } 57 }
55 58
56 void list([bool recursive = false]) { 59 void list([bool recursive = false]) {
57 new _DirectoryListingIsolate().spawn().then((port) { 60 new _DirectoryListingIsolate().spawn().then((port) {
58 // Build a map of parameters to the directory listing isolate. 61 // Build a map of parameters to the directory listing isolate.
59 Map listingParameters = new Map(); 62 Map listingParameters = new Map();
60 listingParameters['dir'] = _path; 63 listingParameters['dir'] = _path;
61 listingParameters['recursive'] = recursive; 64 listingParameters['recursive'] = recursive;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool _create(String path) native "Directory_Create"; 148 bool _create(String path) native "Directory_Create";
146 bool _delete(String path) native "Directory_Delete"; 149 bool _delete(String path) native "Directory_Delete";
147 150
148 var _dirHandler; 151 var _dirHandler;
149 var _fileHandler; 152 var _fileHandler;
150 var _doneHandler; 153 var _doneHandler;
151 var _errorHandler; 154 var _errorHandler;
152 155
153 String _path; 156 String _path;
154 } 157 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/directory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698