OLD | NEW |
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 | 5 |
6 class _Directory implements Directory { | 6 class _Directory implements Directory { |
7 static final kCreateRequest = 0; | 7 static final kCreateRequest = 0; |
8 static final kDeleteRequest = 1; | 8 static final kDeleteRequest = 1; |
9 static final kExistsRequest = 2; | 9 static final kExistsRequest = 2; |
10 static final kCreateTempRequest = 3; | 10 static final kCreateTempRequest = 3; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 break; | 237 break; |
238 case kListError: | 238 case kListError: |
239 var errorType = | 239 var errorType = |
240 message[kResponseError][_FileUtils.kErrorResponseErrorType]; | 240 message[kResponseError][_FileUtils.kErrorResponseErrorType]; |
241 if (errorType == _FileUtils.kIllegalArgumentResponse) { | 241 if (errorType == _FileUtils.kIllegalArgumentResponse) { |
242 _reportError(new IllegalArgumentException()); | 242 _reportError(new IllegalArgumentException()); |
243 } else if (errorType == _FileUtils.kOSErrorResponse) { | 243 } else if (errorType == _FileUtils.kOSErrorResponse) { |
244 var err = new OSError( | 244 var err = new OSError( |
245 message[kResponseError][_FileUtils.kOSErrorResponseMessage], | 245 message[kResponseError][_FileUtils.kOSErrorResponseMessage], |
246 message[kResponseError][_FileUtils.kOSErrorResponseErrorCode]); | 246 message[kResponseError][_FileUtils.kOSErrorResponseErrorCode]); |
| 247 var errorPath = message[kResponsePath]; |
| 248 if (errorPath == null) errorPath = path; |
247 _reportError(new DirectoryIOException("Directory listing failed", | 249 _reportError(new DirectoryIOException("Directory listing failed", |
248 message[kResponsePath], | 250 errorPath, |
249 err)); | 251 err)); |
250 } else { | 252 } else { |
251 _reportError(new DirectoryIOException("Internal error")); | 253 _reportError(new DirectoryIOException("Internal error")); |
252 } | 254 } |
253 break; | 255 break; |
254 case kListDone: | 256 case kListDone: |
255 responsePort.close(); | 257 responsePort.close(); |
256 if (_onDone != null) _onDone(message[kResponseComplete]); | 258 if (_onDone != null) _onDone(message[kResponseComplete]); |
257 break; | 259 break; |
258 } | 260 } |
259 }); | 261 }); |
(...skipping 21 matching lines...) Expand all Loading... |
281 } else { | 283 } else { |
282 throw e; | 284 throw e; |
283 } | 285 } |
284 } | 286 } |
285 | 287 |
286 Function _onDir; | 288 Function _onDir; |
287 Function _onFile; | 289 Function _onFile; |
288 Function _onDone; | 290 Function _onDone; |
289 Function _onError; | 291 Function _onError; |
290 } | 292 } |
OLD | NEW |