mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-15 20:25:18 +02:00
compute path before performing selective sync
This commit is contained in:
parent
65bb14ad37
commit
b703a824c7
20
src/sync.d
20
src/sync.d
|
@ -192,24 +192,26 @@ final class SyncEngine
|
||||||
Item item = makeItem(jsonItem);
|
Item item = makeItem(jsonItem);
|
||||||
log.vlog(item.id, " ", item.name);
|
log.vlog(item.id, " ", item.name);
|
||||||
|
|
||||||
// skip unwanted items early
|
string path = ".";
|
||||||
bool unwanted;
|
bool unwanted;
|
||||||
unwanted |= skippedItems.find(item.parentId).length != 0;
|
unwanted |= skippedItems.find(item.parentId).length != 0;
|
||||||
unwanted |= selectiveSync.isNameExcluded(item.name);
|
unwanted |= selectiveSync.isNameExcluded(item.name);
|
||||||
unwanted |= selectiveSync.isPathExcluded(path);
|
|
||||||
|
if (!unwanted && !isItemRoot(jsonItem)) {
|
||||||
|
// delay path computation after assuring the item parent is not excluded
|
||||||
|
path = itemdb.computePath(item.parentDriveId, item.parentId) ~ "/" ~ item.name;
|
||||||
|
// selective sync
|
||||||
|
unwanted |= selectiveSync.isPathExcluded(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip unwanted items early
|
||||||
if (unwanted) {
|
if (unwanted) {
|
||||||
log.vlog("Filtered out");
|
log.vlog("Filtered out");
|
||||||
skippedItems ~= item.id;
|
skippedItems ~= item.id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute the path of the item
|
// check if the item is going to be deleted
|
||||||
string path = ".";
|
|
||||||
if (!isItemRoot(jsonItem)) {
|
|
||||||
path = itemdb.computePath(item.driveId, item.parentId) ~ "/" ~ item.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if the item is to be deleted
|
|
||||||
if (isItemDeleted(jsonItem)) {
|
if (isItemDeleted(jsonItem)) {
|
||||||
log.vlog("The item is marked for deletion");
|
log.vlog("The item is marked for deletion");
|
||||||
idsToDelete ~= [item.driveId, item.id];
|
idsToDelete ~= [item.driveId, item.id];
|
||||||
|
|
Loading…
Reference in a new issue