mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-24 01:53:20 +00:00
Fixed:
- Fixed a bug about deleting empty directory - Weird behaviour on boot-sequence on mobile devices.
This commit is contained in:
1 parent
5f96cc6b82
commit
d4bbf79514
1 file changed
+13
-2
+13
-2
@@ -842,6 +842,12 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
this.watchedFileEventQueue = [];
|
this.watchedFileEventQueue = [];
|
||||||
for (const queue of procs) {
|
for (const queue of procs) {
|
||||||
const file = queue.args.file;
|
const file = queue.args.file;
|
||||||
|
const key = `file-last-proc-${queue.type}-${file.path}`;
|
||||||
|
const last = Number(await this.localDatabase.kvDB.get(key) || 0);
|
||||||
|
if (file instanceof TFile && file.stat.mtime == last) {
|
||||||
|
Logger(`File has been already scanned on ${queue.type}, skip: ${file.path}`, LOG_LEVEL.VERBOSE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const cache = queue.args.cache;
|
const cache = queue.args.cache;
|
||||||
if ((queue.type == "CREATE" || queue.type == "CHANGED") && file instanceof TFile) {
|
if ((queue.type == "CREATE" || queue.type == "CHANGED") && file instanceof TFile) {
|
||||||
await this.updateIntoDB(file, false, cache);
|
await this.updateIntoDB(file, false, cache);
|
||||||
@@ -856,6 +862,9 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
if (queue.type == "RENAME") {
|
if (queue.type == "RENAME") {
|
||||||
await this.watchVaultRenameAsync(file, queue.args.oldPath);
|
await this.watchVaultRenameAsync(file, queue.args.oldPath);
|
||||||
}
|
}
|
||||||
|
if (file instanceof TFile) {
|
||||||
|
await this.localDatabase.kvDB.set(key, file.stat.mtime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.refreshStatusText();
|
this.refreshStatusText();
|
||||||
})
|
})
|
||||||
@@ -1106,7 +1115,9 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteVaultItem(file: TFile | TFolder) {
|
async deleteVaultItem(file: TFile | TFolder) {
|
||||||
if (!this.isTargetFile(file)) return;
|
if (file instanceof TFile) {
|
||||||
|
if (!this.isTargetFile(file)) return;
|
||||||
|
}
|
||||||
const dir = file.parent;
|
const dir = file.parent;
|
||||||
if (this.settings.trashInsteadDelete) {
|
if (this.settings.trashInsteadDelete) {
|
||||||
await this.app.vault.trash(file, false);
|
await this.app.vault.trash(file, false);
|
||||||
@@ -1718,7 +1729,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
await this.pullFile(e, filesStorage, false, null, false);
|
await this.pullFile(e, filesStorage, false, null, false);
|
||||||
Logger(`Check or pull from db:${e} OK`);
|
Logger(`Check or pull from db:${e} OK`);
|
||||||
} else {
|
} else {
|
||||||
Logger(`entry not found, maybe deleted:${e}`);
|
Logger(`entry not found, maybe deleted (it is normal behavior):${e}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user