aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/index.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-02 11:32:15 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-02 11:32:51 +0100
commit1f56032b22089cb58e5613a714db95753bf807e0 (patch)
treed565c2f06939d564ed511261c4f3802a18bee14d /packages/main/src/index.ts
parentdocs: Add note on typechecking (diff)
downloadsophie-1f56032b22089cb58e5613a714db95753bf807e0.tar.gz
sophie-1f56032b22089cb58e5613a714db95753bf807e0.tar.zst
sophie-1f56032b22089cb58e5613a714db95753bf807e0.zip
fix: Ensure dev user directory exists
Fixes #5 Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r--packages/main/src/index.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts
index 41424ab..ff14332 100644
--- a/packages/main/src/index.ts
+++ b/packages/main/src/index.ts
@@ -24,8 +24,7 @@ import {
24 BrowserWindow, 24 BrowserWindow,
25 ipcMain, 25 ipcMain,
26} from 'electron'; 26} from 'electron';
27import { readFileSync } from 'fs'; 27import { ensureDirSync, readFile, readFileSync } from 'fs-extra';
28import { readFile } from 'fs/promises';
29import { autorun } from 'mobx'; 28import { autorun } from 'mobx';
30import { getSnapshot, onPatch } from 'mobx-state-tree'; 29import { getSnapshot, onPatch } from 'mobx-state-tree';
31import { join } from 'path'; 30import { join } from 'path';
@@ -55,7 +54,9 @@ app.enableSandbox();
55 54
56// Use alternative directory when debugging to avoid clobbering the main installation. 55// Use alternative directory when debugging to avoid clobbering the main installation.
57if (isDevelopment) { 56if (isDevelopment) {
58 app.setPath('userData', `${app.getPath('userData')}-dev`); 57 const devUserDataPath = `${app.getPath('userData')}-dev`;
58 app.setPath('userData', devUserDataPath);
59 ensureDirSync(devUserDataPath);
59} 60}
60 61
61// Only allow a single instance at a time. 62// Only allow a single instance at a time.