aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/folderdownloadrequest.cpp
diff options
context:
space:
mode:
authorAlexander Tkachev2016-05-30 18:13:31 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitaa987e5c52899bfafff4f1f84479a67761569109 (patch)
tree468f076020836c51647b7708558832193cffceab /backends/cloud/folderdownloadrequest.cpp
parenta19fc52c329fdb0611eee7aedfb20fb0d1b9269c (diff)
downloadscummvm-rg350-aa987e5c52899bfafff4f1f84479a67761569109.tar.gz
scummvm-rg350-aa987e5c52899bfafff4f1f84479a67761569109.tar.bz2
scummvm-rg350-aa987e5c52899bfafff4f1f84479a67761569109.zip
CLOUD: Add ListDirectoryStatus struct
It contains flags to indicate whether Request was interrupted or failed, so dependent Requests may see that list is incomplete.
Diffstat (limited to 'backends/cloud/folderdownloadrequest.cpp')
-rw-r--r--backends/cloud/folderdownloadrequest.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/backends/cloud/folderdownloadrequest.cpp b/backends/cloud/folderdownloadrequest.cpp
index 00bddb9f09..db132ffc8a 100644
--- a/backends/cloud/folderdownloadrequest.cpp
+++ b/backends/cloud/folderdownloadrequest.cpp
@@ -50,15 +50,21 @@ void FolderDownloadRequest::start() {
//list directory first
_workingRequest = _storage->listDirectory(
_remoteDirectoryPath,
- new Common::Callback<FolderDownloadRequest, Storage::FileArrayResponse>(this, &FolderDownloadRequest::directoryListedCallback),
+ new Common::Callback<FolderDownloadRequest, Storage::ListDirectoryResponse>(this, &FolderDownloadRequest::directoryListedCallback),
_recursive
);
}
-void FolderDownloadRequest::directoryListedCallback(Storage::FileArrayResponse pair) {
+void FolderDownloadRequest::directoryListedCallback(Storage::ListDirectoryResponse pair) {
if (_ignoreCallback) return;
- //TODO: somehow ListDirectory requests must indicate that file array is incomplete
- _files = pair.value;
+
+ ListDirectoryStatus status = pair.value;
+ if (status.failed || status.interrupted) {
+ finish();
+ return;
+ }
+
+ _files = pair.value.files;
downloadNextFile();
}