Chromium Code Reviews| 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 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 if (result is OSError) { | 219 if (result is OSError) { |
| 220 throw new DirectoryIOException("Rename failed", _path, result); | 220 throw new DirectoryIOException("Rename failed", _path, result); |
| 221 } | 221 } |
| 222 return new Directory(newPath); | 222 return new Directory(newPath); |
| 223 } | 223 } |
| 224 | 224 |
| 225 DirectoryLister list({bool recursive: false}) { | 225 DirectoryLister list({bool recursive: false}) { |
| 226 return new _DirectoryLister(_path, recursive); | 226 return new _DirectoryLister(_path, recursive); |
| 227 } | 227 } |
| 228 | 228 |
| 229 String get path { return _path; } | 229 String get path => _path; |
| 230 | |
| 231 String toString() => "Directory: '$path'"; | |
|
Søren Gjesse
2012/12/21 10:16:00
Are you sure you want the "Directory: " prefix?
Mads Ager (google)
2012/12/21 10:35:03
Good question. I was thinking that it might be hel
| |
| 230 | 232 |
| 231 bool _isErrorResponse(response) { | 233 bool _isErrorResponse(response) { |
| 232 return response is List && response[0] != _SUCCESS_RESPONSE; | 234 return response is List && response[0] != _SUCCESS_RESPONSE; |
| 233 } | 235 } |
| 234 | 236 |
| 235 _exceptionOrErrorFromResponse(response, String message) { | 237 _exceptionOrErrorFromResponse(response, String message) { |
| 236 assert(_isErrorResponse(response)); | 238 assert(_isErrorResponse(response)); |
| 237 switch (response[_ERROR_RESPONSE_ERROR_TYPE]) { | 239 switch (response[_ERROR_RESPONSE_ERROR_TYPE]) { |
| 238 case _ILLEGAL_ARGUMENT_RESPONSE: | 240 case _ILLEGAL_ARGUMENT_RESPONSE: |
| 239 return new ArgumentError(); | 241 return new ArgumentError(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 } else { | 340 } else { |
| 339 throw e; | 341 throw e; |
| 340 } | 342 } |
| 341 } | 343 } |
| 342 | 344 |
| 343 Function _onDir; | 345 Function _onDir; |
| 344 Function _onFile; | 346 Function _onFile; |
| 345 Function _onDone; | 347 Function _onDone; |
| 346 Function _onError; | 348 Function _onError; |
| 347 } | 349 } |
| OLD | NEW |