diff options
Diffstat (limited to 'backends/cloud/dropbox')
-rw-r--r-- | backends/cloud/dropbox/dropboxstorage.cpp | 15 | ||||
-rw-r--r-- | backends/cloud/dropbox/dropboxstorage.h | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp index 1b6dc1b92f..38ad12d94b 100644 --- a/backends/cloud/dropbox/dropboxstorage.cpp +++ b/backends/cloud/dropbox/dropboxstorage.cpp @@ -30,6 +30,7 @@ #include "common/debug.h" #include "common/json.h" #include <curl/curl.h> +#include <common/file.h> namespace Cloud { namespace Dropbox { @@ -100,15 +101,23 @@ Networking::NetworkReadStream *DropboxStorage::streamFile(Common::String path) { return request->execute(); } -void DropboxStorage::download(Common::String path, BoolCallback callback) { - ConnMan.addRequest(new DownloadRequest(callback, streamFile(path))); +void DropboxStorage::download(Common::String remotePath, Common::String localPath, BoolCallback callback) { + Common::DumpFile *f = new Common::DumpFile(); + if (!f->open(localPath)) { + warning("DropboxStorage: unable to open file to download into"); + if (callback) (*callback)(false); + delete f; + return; + } + + ConnMan.addRequest(new DownloadRequest(callback, streamFile(remotePath), f)); } void DropboxStorage::syncSaves(BoolCallback callback) { //this is not the real syncSaves() implementation //"" is root in Dropbox, not "/" //listDirectory("", new Common::Callback<DropboxStorage, Common::Array<StorageFile> >(this, &DropboxStorage::printFiles), true); - download("/notempty.txt", 0); + download("/remote/test.jpg", "local/test.jpg", 0); } void DropboxStorage::info(StorageInfoCallback outerCallback) { diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h index 92c3746da5..415a3fe5fb 100644 --- a/backends/cloud/dropbox/dropboxstorage.h +++ b/backends/cloud/dropbox/dropboxstorage.h @@ -73,7 +73,7 @@ public: virtual Networking::NetworkReadStream *streamFile(Common::String path); /** Calls the callback when finished. */ - virtual void download(Common::String path, BoolCallback callback); + virtual void download(Common::String remotePath, Common::String localPath, BoolCallback callback); /** Calls the callback when finished. */ virtual void remove(Common::String path, BoolCallback callback) {} //TODO |