mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2024-12-12 09:04:06 +02:00
Fixed:
- Fixed a bug about deleting empty directory - Weird behaviour on boot-sequence on mobile devices.
This commit is contained in:
parent
5f96cc6b82
commit
d4bbf79514
13
src/main.ts
13
src/main.ts
@ -842,6 +842,12 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
||||
this.watchedFileEventQueue = [];
|
||||
for (const queue of procs) {
|
||||
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;
|
||||
if ((queue.type == "CREATE" || queue.type == "CHANGED") && file instanceof TFile) {
|
||||
await this.updateIntoDB(file, false, cache);
|
||||
@ -856,6 +862,9 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
||||
if (queue.type == "RENAME") {
|
||||
await this.watchVaultRenameAsync(file, queue.args.oldPath);
|
||||
}
|
||||
if (file instanceof TFile) {
|
||||
await this.localDatabase.kvDB.set(key, file.stat.mtime);
|
||||
}
|
||||
}
|
||||
this.refreshStatusText();
|
||||
})
|
||||
@ -1106,7 +1115,9 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
||||
}
|
||||
|
||||
async deleteVaultItem(file: TFile | TFolder) {
|
||||
if (file instanceof TFile) {
|
||||
if (!this.isTargetFile(file)) return;
|
||||
}
|
||||
const dir = file.parent;
|
||||
if (this.settings.trashInsteadDelete) {
|
||||
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);
|
||||
Logger(`Check or pull from db:${e} OK`);
|
||||
} else {
|
||||
Logger(`entry not found, maybe deleted:${e}`);
|
||||
Logger(`entry not found, maybe deleted (it is normal behavior):${e}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user