mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-04 23:12: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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -243,7 +243,8 @@ final class SyncEngine
|
|||
break;
|
||||
case ItemType.dir:
|
||||
log.log("Creating directory: ", path);
|
||||
mkdir(path);
|
||||
//Use mkdirRecuse to deal nested dir
|
||||
mkdirRecurse(path);
|
||||
break;
|
||||
}
|
||||
setTimes(path, item.mtime, item.mtime);
|
||||
|
|
Loading…
Reference in a new issue