From 10f2c3db6f84e013ce2cef80c6184d9a24d8ba74 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 1 May 2024 15:12:50 +0530 Subject: [PATCH] Mention why we're normalizing --- desktop/src/main/services/dir.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop/src/main/services/dir.ts b/desktop/src/main/services/dir.ts index 4e2a8c65e4..d375648f6f 100644 --- a/desktop/src/main/services/dir.ts +++ b/desktop/src/main/services/dir.ts @@ -17,8 +17,11 @@ export const selectDirectory = async () => { * For example, on macOS this'll open {@link dirPath} in Finder. */ export const openDirectory = async (dirPath: string) => { + // We need to use `path.normalize` because `shell.openPath; does not support + // POSIX path, it needs to be a platform specific path: + // https://github.com/electron/electron/issues/28831#issuecomment-826370589 const res = await shell.openPath(path.normalize(dirPath)); - // shell.openPath resolves with a string containing the error message + // `shell.openPath` resolves with a string containing the error message // corresponding to the failure if a failure occurred, otherwise "". if (res) throw new Error(`Failed to open directory ${dirPath}: res`); };