mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-04 06:52:18 +02:00
Bug fixed: 1. Replace mkdirRecurse with mkdir to deal nested directory;2. Before download an item, check if its dirName exists, if not, build it.
This commit is contained in:
parent
eb8d0fe039
commit
7c112304b5
|
@ -100,10 +100,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,8 @@ 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
|
||||||
|
mkdirRecurse(path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
setTimes(path, item.mtime, item.mtime);
|
setTimes(path, item.mtime, item.mtime);
|
||||||
|
|
Loading…
Reference in a new issue