| 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 extends FileSystemEntity implements Directory { | 7 class _Directory extends FileSystemEntity implements Directory { |
| 8 final String path; | 8 final String path; |
| 9 | 9 |
| 10 _Directory(String this.path) { | 10 _Directory(String this.path) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 fullTemplate, | 185 fullTemplate, |
| 186 result); | 186 result); |
| 187 } | 187 } |
| 188 return new Directory(result); | 188 return new Directory(result); |
| 189 } | 189 } |
| 190 | 190 |
| 191 static Future<Directory> createSystemTemp(String template) { | 191 static Future<Directory> createSystemTemp(String template) { |
| 192 return _IOService.dispatch(_DIRECTORY_CREATE_SYSTEM_TEMP, | 192 return _IOService.dispatch(_DIRECTORY_CREATE_SYSTEM_TEMP, |
| 193 [template]).then((response) { | 193 [template]).then((response) { |
| 194 if (response is List && response[0] != _SUCCESS_RESPONSE) { | 194 if (response is List && response[0] != _SUCCESS_RESPONSE) { |
| 195 throw new Directory(template)._exceptionOrErrorFromResponse( | 195 throw new _Directory(template)._exceptionOrErrorFromResponse( |
| 196 response, "Creation of temporary directory failed"); | 196 response, "Creation of temporary directory failed"); |
| 197 } | 197 } |
| 198 return new Directory(response); | 198 return new Directory(response); |
| 199 }); | 199 }); |
| 200 } | 200 } |
| 201 | 201 |
| 202 static Directory createSystemTempSync(String template) { | 202 static Directory createSystemTempSync(String template) { |
| 203 var result = _createTemp(template, true); | 203 var result = _createTemp(template, true); |
| 204 if (result is OSError) { | 204 if (result is OSError) { |
| 205 throw new DirectoryException("Creation of temporary directory failed", | 205 throw new DirectoryException("Creation of temporary directory failed", |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 controller.addError( | 408 controller.addError( |
| 409 new DirectoryException("Directory listing failed", | 409 new DirectoryException("Directory listing failed", |
| 410 errorPath, | 410 errorPath, |
| 411 err)); | 411 err)); |
| 412 } else { | 412 } else { |
| 413 controller.addError( | 413 controller.addError( |
| 414 new DirectoryException("Internal error")); | 414 new DirectoryException("Internal error")); |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 } | 417 } |
| OLD | NEW |