From 5254db2b85c1f65fd1c3ec515069bb03120b5fd8 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:40:19 +0800 Subject: [PATCH] fix: fileExists lib error --- src/modules/sync/api.ts | 2 +- src/utils/str.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/sync/api.ts b/src/modules/sync/api.ts index 0b4f446..b912fee 100644 --- a/src/modules/sync/api.ts +++ b/src/modules/sync/api.ts @@ -192,7 +192,7 @@ async function getMDFileName(noteId: number, searchDir?: string) { if ( (!searchDir || searchDir === syncStatus.path) && syncStatus.filename && - (await fileExists(`${syncStatus.path}/${syncStatus.filename}`)) + (await fileExists(PathUtils.join(syncStatus.path, syncStatus.filename))) ) { return syncStatus.filename; } diff --git a/src/utils/str.ts b/src/utils/str.ts index ce60278..4a20fa9 100644 --- a/src/utils/str.ts +++ b/src/utils/str.ts @@ -84,7 +84,7 @@ export async function fileExists(path: string): Promise { } try { // IOUtils.exists() will throw error if path is not valid - return await IOUtils.exists(path); + return await IOUtils.exists(formatPath(path)); } catch (e) { ztoolkit.log(e); return false;