add listerner for renamed file
This change avoid to create duplicate data in `vault-stats.json` when a file is renamed by copying the data from the old path to the new one.
This commit is contained in:
parent
9e6550f407
commit
67c8162296
1 changed files with 6 additions and 0 deletions
|
@ -24,6 +24,12 @@ export default class StatsManager {
|
|||
false
|
||||
);
|
||||
|
||||
this.vault.on("rename", (new_name, old_path) => {
|
||||
const content = this.vaultStats.modifiedFiles[old_path];
|
||||
delete this.vaultStats.modifiedFiles[old_path];
|
||||
this.vaultStats.modifiedFiles[new_name.path] = content;
|
||||
});
|
||||
|
||||
this.vault.adapter.exists(STATS_FILE).then(async (exists) => {
|
||||
if (!exists) {
|
||||
const vaultSt: VaultStatistics = {
|
||||
|
|
Loading…
Reference in a new issue