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 const CREATE_REQUEST = 0; | 7 static const CREATE_REQUEST = 0; |
8 static const DELETE_REQUEST = 1; | 8 static const DELETE_REQUEST = 1; |
9 static const EXISTS_REQUEST = 2; | 9 static const EXISTS_REQUEST = 2; |
10 static const CREATE_TEMP_REQUEST = 3; | 10 static const CREATE_TEMP_REQUEST = 3; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (_path is !String || newPath is !String) { | 162 if (_path is !String || newPath is !String) { |
163 throw new ArgumentError(); | 163 throw new ArgumentError(); |
164 } | 164 } |
165 var result = _rename(_path, newPath); | 165 var result = _rename(_path, newPath); |
166 if (result is OSError) { | 166 if (result is OSError) { |
167 throw new DirectoryIOException("Rename failed", _path, result); | 167 throw new DirectoryIOException("Rename failed", _path, result); |
168 } | 168 } |
169 return new Directory(newPath); | 169 return new Directory(newPath); |
170 } | 170 } |
171 | 171 |
172 DirectoryLister list([bool recursive = false]) { | 172 DirectoryLister list({bool recursive: false}) { |
173 return new _DirectoryLister(_path, recursive); | 173 return new _DirectoryLister(_path, recursive); |
174 } | 174 } |
175 | 175 |
176 String get path { return _path; } | 176 String get path { return _path; } |
177 | 177 |
178 bool _isErrorResponse(response) { | 178 bool _isErrorResponse(response) { |
179 return response is List && response[0] != _SUCCESS_RESPONSE; | 179 return response is List && response[0] != _SUCCESS_RESPONSE; |
180 } | 180 } |
181 | 181 |
182 Exception _exceptionFromResponse(response, String message) { | 182 Exception _exceptionFromResponse(response, String message) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } else { | 285 } else { |
286 throw e; | 286 throw e; |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 Function _onDir; | 290 Function _onDir; |
291 Function _onFile; | 291 Function _onFile; |
292 Function _onDone; | 292 Function _onDone; |
293 Function _onError; | 293 Function _onError; |
294 } | 294 } |
OLD | NEW |