diff options
-rw-r--r-- | backends/cloud/dropbox/dropboxstorage.cpp | 2 | ||||
-rw-r--r-- | backends/cloud/dropbox/dropboxstorage.h | 3 | ||||
-rw-r--r-- | backends/cloud/onedrive/onedrivestorage.cpp | 9 | ||||
-rw-r--r-- | backends/cloud/onedrive/onedrivestorage.h | 3 | ||||
-rw-r--r-- | backends/cloud/savessyncrequest.cpp | 5 | ||||
-rw-r--r-- | backends/cloud/storage.h | 3 |
6 files changed, 17 insertions, 8 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp index 7ba072d578..beb510882a 100644 --- a/backends/cloud/dropbox/dropboxstorage.cpp +++ b/backends/cloud/dropbox/dropboxstorage.cpp @@ -178,6 +178,8 @@ Networking::Request *DropboxStorage::info(StorageInfoCallback outerCallback, Net //and then calls the outerCallback (which wants to receive StorageInfo, not void *) } +Common::String DropboxStorage::savesDirectoryPath() { return "/saves/"; } + void DropboxStorage::infoInnerCallback(StorageInfoCallback outerCallback, Networking::JsonResponse response) { Common::JSONValue *json = response.value; if (!json) { diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h index a5ef76a3d6..90a1d270e8 100644 --- a/backends/cloud/dropbox/dropboxstorage.h +++ b/backends/cloud/dropbox/dropboxstorage.h @@ -103,6 +103,9 @@ public: /** This method is passed into info(). (Temporary) */ void infoMethodCallback(StorageInfoResponse response); + /** Returns storage's saves directory path with the trailing slash. */ + virtual Common::String savesDirectoryPath(); + /** Returns whether saves sync process is running. */ virtual bool isSyncing() { return false; } //TODO diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index fe10580616..1e9a641e8a 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -238,14 +238,11 @@ Networking::Request *OneDriveStorage::syncSaves(BoolCallback callback, Networkin request->addHeader("Authorization: bearer " + _token); return ConnMan.addRequest(request); */ - //return downloadFolder("subfolder", "local/onedrive/subfolder_downloaded", new Common::Callback<OneDriveStorage, FileArrayResponse>(this, &OneDriveStorage::printFiles), false); - return Storage::upload( - "uploads/test.jpg", "test.jpg", - new Common::Callback<OneDriveStorage, UploadResponse>(this, &OneDriveStorage::printFile), getErrorPrintingCallback() - ); - //return ConnMan.addRequest(new SavesSyncRequest(this, new Common::Callback<OneDriveStorage, BoolResponse>(this, &OneDriveStorage::printBool), getErrorPrintingCallback())); //TODO + return ConnMan.addRequest(new SavesSyncRequest(this, new Common::Callback<OneDriveStorage, BoolResponse>(this, &OneDriveStorage::printBool), getErrorPrintingCallback())); //TODO } +Common::String OneDriveStorage::savesDirectoryPath() { return "saves/"; } + OneDriveStorage *OneDriveStorage::loadFromConfig(Common::String keyPrefix) { loadKeyAndSecret(); diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h index 0ced98cd4e..45a8dca331 100644 --- a/backends/cloud/onedrive/onedrivestorage.h +++ b/backends/cloud/onedrive/onedrivestorage.h @@ -107,6 +107,9 @@ public: /** Returns the StorageInfo struct. */ virtual Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) { return nullptr; } //TODO + /** Returns storage's saves directory path with the trailing slash. */ + virtual Common::String savesDirectoryPath(); + /** Returns whether saves sync process is running. */ virtual bool isSyncing() { return false; } //TODO diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index b48a99a48c..9727738654 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -60,7 +60,7 @@ void SavesSyncRequest::start() { //list saves directory _workingRequest = _storage->listDirectory( - "/saves", + _storage->savesDirectoryPath(), new Common::Callback<SavesSyncRequest, Storage::ListDirectoryResponse>(this, &SavesSyncRequest::directoryListedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::directoryListedErrorCallback) ); @@ -165,6 +165,7 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er //we're lucky - user just lacks his "/cloud/" folder Common::Array<StorageFile> files; directoryListedCallback(Storage::ListDirectoryResponse(error.request, files)); + //TODO: create it before uploading stuff } void SavesSyncRequest::downloadNextFile() { @@ -222,7 +223,7 @@ void SavesSyncRequest::uploadNextFile() { /////// debug("uploading %s", _currentUploadingFile.c_str()); /////// - _workingRequest = _storage->upload("/saves/" + _currentUploadingFile, g_system->getSavefileManager()->openRawFile(_currentUploadingFile), + _workingRequest = _storage->upload(_storage->savesDirectoryPath() + _currentUploadingFile, g_system->getSavefileManager()->openRawFile(_currentUploadingFile), new Common::Callback<SavesSyncRequest, Storage::UploadResponse>(this, &SavesSyncRequest::fileUploadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileUploadedErrorCallback) ); diff --git a/backends/cloud/storage.h b/backends/cloud/storage.h index 1d92189fa4..4bd2aa3fb1 100644 --- a/backends/cloud/storage.h +++ b/backends/cloud/storage.h @@ -103,6 +103,9 @@ public: /** Returns the StorageInfo struct. */ virtual Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) = 0; + /** Returns storage's saves directory path with the trailing slash. */ + virtual Common::String savesDirectoryPath() = 0; + /** Returns whether saves sync process is running. */ virtual bool isSyncing() = 0; |