aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-08 12:34:13 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1 (patch)
tree8d5dcb25bd8fb981b49a07600ce07416152387c8 /backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp
parentf6e69b62765482d290b7673e97fb7cf6a03fc943 (diff)
downloadscummvm-rg350-7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1.tar.gz
scummvm-rg350-7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1.tar.bz2
scummvm-rg350-7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1.zip
CLOUD: Update GoogleDriveStorage and StorageFile
Because of the Google Drive StorageFile now contains yet another field, `id`. For other storages `id` == `path`, and thus all common Requests (such as SavesSyncRequest, DownloadFolderRequest, etc) must be using id() instead of path(). That way these Requests won't cause id resolving which could be quite slow (when you call it for all files in the folder, for example).
Diffstat (limited to 'backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp')
-rw-r--r--backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp
index f7aa7a1c0c..f9af363254 100644
--- a/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp
+++ b/backends/cloud/googledrive/googledrivelistdirectorybyidrequest.cpp
@@ -108,7 +108,7 @@ void GoogleDriveListDirectoryByIdRequest::responseCallback(Networking::JsonRespo
Common::JSONArray items = responseObject.getVal("files")->asArray();
for (uint32 i = 0; i < items.size(); ++i) {
Common::JSONObject item = items[i]->asObject();
- Common::String path = item.getVal("id")->asString();
+ Common::String id = item.getVal("id")->asString();
Common::String name = item.getVal("name")->asString();
bool isDirectory = (item.getVal("mimeType")->asString() == "application/vnd.google-apps.folder");
uint32 size = 0, timestamp = 0;
@@ -116,7 +116,9 @@ void GoogleDriveListDirectoryByIdRequest::responseCallback(Networking::JsonRespo
size = atoull(item.getVal("size")->asString());
if (item.contains("modifiedTime") && item.getVal("modifiedTime")->isString())
timestamp = ISO8601::convertToTimestamp(item.getVal("modifiedTime")->asString());
- _files.push_back(StorageFile(path, name, size, timestamp, isDirectory));
+
+ //as we list directory by id, we can't determine full path for the file, so we leave it empty
+ _files.push_back(StorageFile(id, "", name, size, timestamp, isDirectory));
}
}