diff options
author | Alexander Tkachev | 2016-05-25 16:32:22 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | ae8e7f39f5b3e4f647a29d39d19cce7626528bb1 (patch) | |
tree | bf1031fbf6bedd96056b8a427f2bf647499b44e6 /backends/cloud/dropbox | |
parent | d014b5bf3826d78de269891ccf6722e58d7a5bcd (diff) | |
download | scummvm-rg350-ae8e7f39f5b3e4f647a29d39d19cce7626528bb1.tar.gz scummvm-rg350-ae8e7f39f5b3e4f647a29d39d19cce7626528bb1.tar.bz2 scummvm-rg350-ae8e7f39f5b3e4f647a29d39d19cce7626528bb1.zip |
CLOUD: Make download() create necessary directories
DumpFile::open() with createPath=true create would create the missing
directories from the path before opening a file. Thus, one can easily
create a file and avoid "can't open a file" error.
Diffstat (limited to 'backends/cloud/dropbox')
-rw-r--r-- | backends/cloud/dropbox/dropboxstorage.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp index 38ad12d94b..e5041466e9 100644 --- a/backends/cloud/dropbox/dropboxstorage.cpp +++ b/backends/cloud/dropbox/dropboxstorage.cpp @@ -103,7 +103,7 @@ Networking::NetworkReadStream *DropboxStorage::streamFile(Common::String path) { void DropboxStorage::download(Common::String remotePath, Common::String localPath, BoolCallback callback) { Common::DumpFile *f = new Common::DumpFile(); - if (!f->open(localPath)) { + if (!f->open(localPath, true)) { warning("DropboxStorage: unable to open file to download into"); if (callback) (*callback)(false); delete f; @@ -116,8 +116,8 @@ void DropboxStorage::download(Common::String remotePath, Common::String localPat 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("/remote/test.jpg", "local/test.jpg", 0); + //this must create all these directories: + download("/remote/test.jpg", "local/a/b/c/d/test.jpg", 0); } void DropboxStorage::info(StorageInfoCallback outerCallback) { |