Merge pull request #204 from lanhin/master

Fixed bugs where the app fails to create nested directories.
This commit is contained in:
skilion 2017-06-22 17:20:12 +02:00 committed by GitHub
commit 1558e793a3
2 changed files with 8 additions and 3 deletions

View file

@ -123,10 +123,14 @@ final class OneDriveApi
void downloadById(const(char)[] id, string saveToPath)
{
checkAccessTokenExpired();
import std.file;
scope(failure) {
import std.file;
if (exists(saveToPath)) remove(saveToPath);
}
// mkdir if need, or File(saveToPath, "wb") may fail
if ( !exists(dirName(saveToPath)) ) {
mkdirRecurse(dirName(saveToPath));
}
const(char)[] url = itemByIdUrl ~ id ~ "/content?AVOverride=1";
download(url, saveToPath);
}

View file

@ -281,8 +281,9 @@ final class SyncEngine
break;
case ItemType.dir:
log.log("Creating directory: ", path);
mkdir(path);
break;
//Use mkdirRecuse to deal nested dir
mkdirRecurse(path);
break;
case ItemType.remote:
assert(0);
}