| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void createTemp(void callback()) { | 67 void createTemp(void callback()) { |
| 68 _ensureDirectoryService(); | 68 _ensureDirectoryService(); |
| 69 List request = new List(2); | 69 List request = new List(2); |
| 70 request[0] = kCreateTempRequest; | 70 request[0] = kCreateTempRequest; |
| 71 request[1] = _path; | 71 request[1] = _path; |
| 72 _directoryService.call(request).then((result) { | 72 _directoryService.call(request).then((result) { |
| 73 if (result is !List) { | 73 if (result is !List) { |
| 74 _path = result; | 74 _path = result; |
| 75 callback(); | 75 callback(); |
| 76 } else if (_onError != null) { | 76 } else if (_onError != null) { |
| 77 _onError("Could not create temporary directory [$_path]: " + | 77 _onError("Could not create temporary directory [$_path]: ${result[1]}"); |
| 78 "${result[1]}"); | |
| 79 } | 78 } |
| 80 }); | 79 }); |
| 81 } | 80 } |
| 82 | 81 |
| 83 void createTempSync() { | 82 void createTempSync() { |
| 84 if (_path is !String) { | 83 if (_path is !String) { |
| 85 throw new IllegalArgumentException(); | 84 throw new IllegalArgumentException(); |
| 86 } | 85 } |
| 87 var result = _createTemp(path); | 86 var result = _createTemp(path); |
| 88 if (result is OSError) { | 87 if (result is OSError) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 192 } |
| 194 | 193 |
| 195 var _onDir; | 194 var _onDir; |
| 196 var _onFile; | 195 var _onFile; |
| 197 var _onDone; | 196 var _onDone; |
| 198 var _onError; | 197 var _onError; |
| 199 | 198 |
| 200 String _path; | 199 String _path; |
| 201 SendPort _directoryService; | 200 SendPort _directoryService; |
| 202 } | 201 } |
| OLD | NEW |