| 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 // Used for holding error code and error message for failed OS system calls. | 6 // Used for holding error code and error message for failed OS system calls. |
| 7 class _OSStatus { | 7 class _OSStatus { |
| 8 int _errorCode; | 8 int _errorCode; |
| 9 String _errorMessage; | 9 String _errorMessage; |
| 10 } | 10 } |
| 11 | 11 |
| 12 | 12 |
| 13 class _Directory implements Directory { | 13 class _Directory implements Directory { |
| 14 static final kCreateRequest = 0; | 14 static final kCreateRequest = 0; |
| 15 static final kDeleteRequest = 1; | 15 static final kDeleteRequest = 1; |
| 16 static final kExistsRequest = 2; | 16 static final kExistsRequest = 2; |
| 17 static final kCreateTempRequest = 3; | 17 static final kCreateTempRequest = 3; |
| 18 static final kListRequest = 4; | 18 static final kListRequest = 4; |
| 19 | 19 |
| 20 _Directory(String this._path); | 20 _Directory(String this._path); |
| 21 _Directory.current() : _path = _current(); |
| 21 | 22 |
| 23 static String _current() native "Directory_Current"; |
| 22 static String _createTemp(String template, | 24 static String _createTemp(String template, |
| 23 _OSStatus status) native "Directory_CreateTemp"; | 25 _OSStatus status) native "Directory_CreateTemp"; |
| 24 static int _exists(String path) native "Directory_Exists"; | 26 static int _exists(String path) native "Directory_Exists"; |
| 25 static bool _create(String path) native "Directory_Create"; | 27 static bool _create(String path) native "Directory_Create"; |
| 26 static bool _delete(String path, bool recursive) native "Directory_Delete"; | 28 static bool _delete(String path, bool recursive) native "Directory_Delete"; |
| 27 static SendPort _newServicePort() native "Directory_NewServicePort"; | 29 static SendPort _newServicePort() native "Directory_NewServicePort"; |
| 28 | 30 |
| 29 void exists(void callback(bool exists)) { | 31 void exists(void callback(bool exists)) { |
| 30 _ensureDirectoryService(); | 32 _ensureDirectoryService(); |
| 31 List request = new List(2); | 33 List request = new List(2); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 202 } |
| 201 | 203 |
| 202 var _onDir; | 204 var _onDir; |
| 203 var _onFile; | 205 var _onFile; |
| 204 var _onDone; | 206 var _onDone; |
| 205 var _onError; | 207 var _onError; |
| 206 | 208 |
| 207 String _path; | 209 String _path; |
| 208 SendPort _directoryService; | 210 SendPort _directoryService; |
| 209 } | 211 } |
| OLD | NEW |