mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-15 20:25:18 +02:00
Merge pull request #204 from lanhin/master
Fixed bugs where the app fails to create nested directories.
This commit is contained in:
commit
1558e793a3
|
@ -123,10 +123,14 @@ final class OneDriveApi
|
||||||
void downloadById(const(char)[] id, string saveToPath)
|
void downloadById(const(char)[] id, string saveToPath)
|
||||||
{
|
{
|
||||||
checkAccessTokenExpired();
|
checkAccessTokenExpired();
|
||||||
|
import std.file;
|
||||||
scope(failure) {
|
scope(failure) {
|
||||||
import std.file;
|
|
||||||
if (exists(saveToPath)) remove(saveToPath);
|
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";
|
const(char)[] url = itemByIdUrl ~ id ~ "/content?AVOverride=1";
|
||||||
download(url, saveToPath);
|
download(url, saveToPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,8 +281,9 @@ final class SyncEngine
|
||||||
break;
|
break;
|
||||||
case ItemType.dir:
|
case ItemType.dir:
|
||||||
log.log("Creating directory: ", path);
|
log.log("Creating directory: ", path);
|
||||||
mkdir(path);
|
//Use mkdirRecuse to deal nested dir
|
||||||
break;
|
mkdirRecurse(path);
|
||||||
|
break;
|
||||||
case ItemType.remote:
|
case ItemType.remote:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue