From e6ffe8cbdc14da6c32c8d97935e799096c66f75e Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 12 Jan 2025 11:34:40 +0000 Subject: [PATCH] Fix file moves --- plugin/src/file-operations/obsidian-file-operations.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugin/src/file-operations/obsidian-file-operations.ts b/plugin/src/file-operations/obsidian-file-operations.ts index 128d5ea7..41a2df00 100644 --- a/plugin/src/file-operations/obsidian-file-operations.ts +++ b/plugin/src/file-operations/obsidian-file-operations.ts @@ -116,15 +116,17 @@ export class ObsidianFileOperations implements FileOperations { oldPath: RelativePath, newPath: RelativePath ): Promise { + oldPath = normalizePath(oldPath); + newPath = normalizePath(newPath); + Logger.getInstance().debug(`Moving file: ${oldPath} -> ${newPath}`); + if (oldPath === newPath) { return; } - await this.vault.adapter.rename( - normalizePath(oldPath), - normalizePath(newPath) - ); + await this.createParentDirectories(newPath); + await this.vault.adapter.rename(oldPath, newPath); } public isFileEligibleForSync(path: RelativePath): boolean {