From a0cea8683e945d0ed23ec846e26bc11111b31ae2 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Fri, 18 Aug 2023 16:00:33 +0530 Subject: [PATCH] fix: use fallback if documents not available --- main/registerIpcMainActionListeners.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main/registerIpcMainActionListeners.ts b/main/registerIpcMainActionListeners.ts index 7194dad0..d3e60626 100644 --- a/main/registerIpcMainActionListeners.ts +++ b/main/registerIpcMainActionListeners.ts @@ -41,7 +41,13 @@ export default function registerIpcMainActionListeners(main: Main) { ipcMain.handle( IPC_ACTIONS.GET_DB_DEFAULT_PATH, async (_, companyName: string) => { - let root = app.getPath('documents'); + let root: string; + try { + root = app.getPath('documents'); + } catch { + root = app.getPath('userData'); + } + if (main.isDevelopment) { root = 'dbs'; }