aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-08 12:45:58 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit60add0df1b63dbd31b88edcabf0769eb675efab0 (patch)
treea09c1885b965c726aeb1e75c57fe9a3014ac4438
parent7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1 (diff)
downloadscummvm-rg350-60add0df1b63dbd31b88edcabf0769eb675efab0.tar.gz
scummvm-rg350-60add0df1b63dbd31b88edcabf0769eb675efab0.tar.bz2
scummvm-rg350-60add0df1b63dbd31b88edcabf0769eb675efab0.zip
CLOUD: Update Requests to use StorageFile::id()
Only two places to update, as others still require id resolving.
-rw-r--r--backends/cloud/folderdownloadrequest.cpp4
-rw-r--r--backends/cloud/savessyncrequest.cpp2
-rw-r--r--backends/cloud/storage.cpp5
-rw-r--r--backends/cloud/storage.h1
4 files changed, 9 insertions, 3 deletions
diff --git a/backends/cloud/folderdownloadrequest.cpp b/backends/cloud/folderdownloadrequest.cpp
index 19f6c6c9b7..905b0c79f4 100644
--- a/backends/cloud/folderdownloadrequest.cpp
+++ b/backends/cloud/folderdownloadrequest.cpp
@@ -109,8 +109,8 @@ void FolderDownloadRequest::downloadNextFile() {
localPath = _localDirectoryPath + "/" + localPath;
}
debug("%s -> %s", remotePath.c_str(), localPath.c_str());
- _workingRequest = _storage->download(
- remotePath, localPath,
+ _workingRequest = _storage->downloadById(
+ _currentFile.id(), localPath,
new Common::Callback<FolderDownloadRequest, Storage::BoolResponse>(this, &FolderDownloadRequest::fileDownloadedCallback),
new Common::Callback<FolderDownloadRequest, Networking::ErrorResponse>(this, &FolderDownloadRequest::fileDownloadedErrorCallback)
);
diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp
index 1d4ec4c2ee..cdf1dbac07 100644
--- a/backends/cloud/savessyncrequest.cpp
+++ b/backends/cloud/savessyncrequest.cpp
@@ -227,7 +227,7 @@ void SavesSyncRequest::downloadNextFile() {
///////
debug("downloading %s (%d %%)", _currentDownloadingFile.name().c_str(), (int)(getProgress() * 100));
///////
- _workingRequest = _storage->download(_currentDownloadingFile.path(), concatWithSavesPath(_currentDownloadingFile.name()),
+ _workingRequest = _storage->downloadById(_currentDownloadingFile.id(), concatWithSavesPath(_currentDownloadingFile.name()),
new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::fileDownloadedCallback),
new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileDownloadedErrorCallback)
);
diff --git a/backends/cloud/storage.cpp b/backends/cloud/storage.cpp
index 5458276e39..f0c1319846 100644
--- a/backends/cloud/storage.cpp
+++ b/backends/cloud/storage.cpp
@@ -92,6 +92,11 @@ Networking::Request *Storage::download(Common::String remotePath, Common::String
return addRequest(new DownloadRequest(this, callback, errorCallback, remotePath, f));
}
+Networking::Request *Storage::downloadById(Common::String remoteId, Common::String localPath, BoolCallback callback, Networking::ErrorCallback errorCallback) {
+ //most Storages use paths instead of ids, so this should work
+ return download(remoteId, localPath, callback, errorCallback);
+}
+
Networking::Request *Storage::downloadFolder(Common::String remotePath, Common::String localPath, FileArrayCallback callback, Networking::ErrorCallback errorCallback, bool recursive) {
if (!errorCallback) errorCallback = getErrorPrintingCallback();
return addRequest(new FolderDownloadRequest(this, callback, errorCallback, remotePath, localPath, recursive));
diff --git a/backends/cloud/storage.h b/backends/cloud/storage.h
index 058e831e5d..3cf8fb55ff 100644
--- a/backends/cloud/storage.h
+++ b/backends/cloud/storage.h
@@ -122,6 +122,7 @@ public:
/** Calls the callback when finished. */
virtual Networking::Request *download(Common::String remotePath, Common::String localPath, BoolCallback callback, Networking::ErrorCallback errorCallback);
+ virtual Networking::Request *downloadById(Common::String remoteId, Common::String localPath, BoolCallback callback, Networking::ErrorCallback errorCallback);
/** Returns Common::Array<StorageFile> with list of files, which were not downloaded. */
virtual Networking::Request *downloadFolder(Common::String remotePath, Common::String localPath, FileArrayCallback callback, Networking::ErrorCallback errorCallback, bool recursive = false);