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

Side by Side Diff: sdk/lib/io/directory_impl.dart

Issue 18090003: Add FileException.path and clean up file exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: CLean up test and remove debug code. Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/directory.dart ('k') | sdk/lib/io/file.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.io; 5 part of dart.io;
6 6
7 class _Directory implements Directory { 7 class _Directory implements Directory {
8 static const CREATE_REQUEST = 0; 8 static const CREATE_REQUEST = 0;
9 static const DELETE_REQUEST = 1; 9 static const DELETE_REQUEST = 1;
10 static const EXISTS_REQUEST = 2; 10 static const EXISTS_REQUEST = 2;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 } 162 }
163 163
164 Future<Directory> createTemp() { 164 Future<Directory> createTemp() {
165 _ensureDirectoryService(); 165 _ensureDirectoryService();
166 List request = new List(2); 166 List request = new List(2);
167 request[0] = CREATE_TEMP_REQUEST; 167 request[0] = CREATE_TEMP_REQUEST;
168 request[1] = _path; 168 request[1] = _path;
169 return _directoryService.call(request).then((response) { 169 return _directoryService.call(request).then((response) {
170 if (_isErrorResponse(response)) { 170 if (_isErrorResponse(response)) {
171 throw _exceptionOrErrorFromResponse(response, 171 throw _exceptionOrErrorFromResponse(
172 "Creation of temporary directory failed"); 172 response, "Creation of temporary directory failed");
173 } 173 }
174 return new Directory(response); 174 return new Directory(response);
175 }); 175 });
176 } 176 }
177 177
178 Directory createTempSync() { 178 Directory createTempSync() {
179 if (_path is !String) { 179 if (_path is !String) {
180 throw new ArgumentError(); 180 throw new ArgumentError();
181 } 181 }
182 var result = _createTemp(path); 182 var result = _createTemp(path);
183 if (result is OSError) { 183 if (result is OSError) {
184 throw new DirectoryException("Creation of temporary directory failed", 184 throw new DirectoryException("Creation of temporary directory failed",
185 _path, 185 _path,
186 result); 186 result);
187 } 187 }
188 return new Directory(result); 188 return new Directory(result);
189 } 189 }
190 190
191 Future<Directory> delete({recursive: false}) { 191 Future<Directory> delete({recursive: false}) {
192 _ensureDirectoryService(); 192 _ensureDirectoryService();
193 List request = new List(3); 193 List request = new List(3);
194 request[0] = DELETE_REQUEST; 194 request[0] = DELETE_REQUEST;
195 request[1] = _path; 195 request[1] = _path;
196 request[2] = recursive; 196 request[2] = recursive;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 controller.addError( 425 controller.addError(
426 new DirectoryException("Directory listing failed", 426 new DirectoryException("Directory listing failed",
427 errorPath, 427 errorPath,
428 err)); 428 err));
429 } else { 429 } else {
430 controller.addError( 430 controller.addError(
431 new DirectoryException("Internal error")); 431 new DirectoryException("Internal error"));
432 } 432 }
433 } 433 }
434 } 434 }
OLDNEW
« no previous file with comments | « sdk/lib/io/directory.dart ('k') | sdk/lib/io/file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698