Index: runtime/bin/directory_impl.dart |
diff --git a/runtime/bin/directory_impl.dart b/runtime/bin/directory_impl.dart |
index d5a9953b38fb08b9cf9bb3633e1c41d30cfcdd5a..7042bb12102db46564564372ca8ccd7fa613ac61 100644 |
--- a/runtime/bin/directory_impl.dart |
+++ b/runtime/bin/directory_impl.dart |
@@ -35,10 +35,10 @@ class _Directory implements Directory { |
request[1] = _path; |
_directoryService.call(request).receive((result, replyTo) { |
var handler = |
- (_existsHandler != null) ? _existsHandler : (result) => null; |
+ (_onExists != null) ? _onExists : (result) => null; |
if (result < 0) { |
- if (_errorHandler != null) { |
- _errorHandler("Diretory exists test failed: $_path"); |
+ if (_onError != null) { |
+ _onError("Diretory exists test failed: $_path"); |
} |
} else { |
handler(result == 1); |
@@ -63,9 +63,9 @@ class _Directory implements Directory { |
request[1] = _path; |
_directoryService.call(request).receive((result, replyTo) { |
if (result) { |
- if (_createHandler != null) _createHandler(); |
- } else if (_errorHandler != null) { |
- _errorHandler("Directory creation failed: $_path"); |
+ if (_onCreate != null) _onCreate(); |
+ } else if (_onError != null) { |
+ _onError("Directory creation failed: $_path"); |
} |
}); |
} |
@@ -86,9 +86,9 @@ class _Directory implements Directory { |
_directoryService.call(request).receive((result, replyTo) { |
if (result is !List) { |
_path = result; |
- if (_createTempHandler != null) _createTempHandler(); |
- } else if (_errorHandler != null) { |
- _errorHandler("Could not create temporary directory [$_path]: " + |
+ if (_onCreateTemp != null) _onCreateTemp(); |
+ } else if (_onError != null) { |
+ _onError("Could not create temporary directory [$_path]: " + |
"${result[1]}"); |
} |
}); |
@@ -117,12 +117,12 @@ class _Directory implements Directory { |
request[2] = recursive; |
_directoryService.call(request).receive((result, replyTo) { |
if (result) { |
- if (_deleteHandler != null) _deleteHandler(); |
- } else if (_errorHandler != null) { |
+ if (_onDelete != null) _onDelete(); |
+ } else if (_onError != null) { |
if (recursive) { |
- _errorHandler("Recursive directory deletion failed: $_path"); |
+ _onError("Recursive directory deletion failed: $_path"); |
} else { |
- _errorHandler("Non-recursive directory deletion failed: $_path"); |
+ _onError("Non-recursive directory deletion failed: $_path"); |
} |
} |
}); |
@@ -151,57 +151,57 @@ class _Directory implements Directory { |
responsePort.receive((message, replyTo) { |
if (message is !List || message[0] is !int) { |
responsePort.close(); |
- if (_errorHandler != null) _errorHandler("Internal error"); |
+ if (_onError != null) _onError("Internal error"); |
return; |
} |
switch (message[0]) { |
case kListDirectory: |
- if (_dirHandler != null) _dirHandler(message[1]); |
+ if (_onDir != null) _onDir(message[1]); |
break; |
case kListFile: |
- if (_fileHandler != null) _fileHandler(message[1]); |
+ if (_onFile != null) _onFile(message[1]); |
break; |
case kListError: |
- if (_errorHandler != null) _errorHandler(message[1]); |
+ if (_onError != null) _onError(message[1]); |
break; |
case kListDone: |
responsePort.close(); |
- if (_doneHandler != null) _doneHandler(message[1]); |
+ if (_onDone != null) _onDone(message[1]); |
break; |
} |
}); |
} |
- void set dirHandler(void dirHandler(String dir)) { |
- _dirHandler = dirHandler; |
+ void set onDir(void onDir(String dir)) { |
+ _onDir = onDir; |
} |
- void set fileHandler(void fileHandler(String file)) { |
- _fileHandler = fileHandler; |
+ void set onFile(void onFile(String file)) { |
+ _onFile = onFile; |
} |
- void set doneHandler(void doneHandler(bool completed)) { |
- _doneHandler = doneHandler; |
+ void set onDone(void onDone(bool completed)) { |
+ _onDone = onDone; |
} |
- void set existsHandler(void existsHandler(bool exists)) { |
- _existsHandler = existsHandler; |
+ void set onExists(void onExists(bool exists)) { |
+ _onExists = onExists; |
} |
- void set createHandler(void createHandler()) { |
- _createHandler = createHandler; |
+ void set onCreate(void onCreate()) { |
+ _onCreate = onCreate; |
} |
- void set createTempHandler(void createTempHandler()) { |
- _createTempHandler = createTempHandler; |
+ void set onCreateTemp(void onCreateTemp()) { |
+ _onCreateTemp = onCreateTemp; |
} |
- void set deleteHandler(void deleteHandler()) { |
- _deleteHandler = deleteHandler; |
+ void set onDelete(void onDelete()) { |
+ _onDelete = onDelete; |
} |
- void set errorHandler(void errorHandler(String error)) { |
- _errorHandler = errorHandler; |
+ void set onError(void onError(String error)) { |
+ _onError = onError; |
} |
void _closePort(ReceivePort port) { |
@@ -212,14 +212,14 @@ class _Directory implements Directory { |
String get path() { return _path; } |
- var _dirHandler; |
- var _fileHandler; |
- var _doneHandler; |
- var _existsHandler; |
- var _createHandler; |
- var _createTempHandler; |
- var _deleteHandler; |
- var _errorHandler; |
+ var _onDir; |
+ var _onFile; |
+ var _onDone; |
+ var _onExists; |
+ var _onCreate; |
+ var _onCreateTemp; |
+ var _onDelete; |
+ var _onError; |
String _path; |
SendPort _directoryService; |