aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/index.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-04-26 16:55:57 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-16 00:55:02 +0200
commitb971de0717a66ae6085670fe5d3a469e236a9446 (patch)
treec64352908648512bad713fc1e91dd5f07a66968c /packages/main/src/index.ts
parentrefactor: remove json5 dependency (diff)
downloadsophie-b971de0717a66ae6085670fe5d3a469e236a9446.tar.gz
sophie-b971de0717a66ae6085670fe5d3a469e236a9446.tar.zst
sophie-b971de0717a66ae6085670fe5d3a469e236a9446.zip
refactor: config file saving and debugging
Reduce the number of dependencies and the amount of code running in a security sensitive context. Instead of a deep comparison, we just compare the serialized versions of the config files. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r--packages/main/src/index.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts
index 29a8cca..78861c2 100644
--- a/packages/main/src/index.ts
+++ b/packages/main/src/index.ts
@@ -22,10 +22,11 @@
22import os from 'node:os'; 22import os from 'node:os';
23 23
24import { app } from 'electron'; 24import { app } from 'electron';
25import { ensureDirSync } from 'fs-extra';
26import osName from 'os-name';
27 25
28import { enableStacktraceSourceMaps } from './infrastructure/electron/impl/devTools'; 26import {
27 enableStacktraceSourceMaps,
28 ensureDevDataDir,
29} from './infrastructure/electron/impl/devTools';
29import electronShell from './infrastructure/electron/impl/electronShell'; 30import electronShell from './infrastructure/electron/impl/electronShell';
30import initReactions from './initReactions'; 31import initReactions from './initReactions';
31import MainStore from './stores/MainStore'; 32import MainStore from './stores/MainStore';
@@ -39,11 +40,7 @@ const log = getLogger('index');
39app.enableSandbox(); 40app.enableSandbox();
40 41
41if (isDevelopment) { 42if (isDevelopment) {
42 // Use alternative directory when debugging to avoid clobbering the main installation. 43 ensureDevDataDir();
43 app.setPath('userData', `${app.getPath('userData')}-dev`);
44 ensureDirSync(app.getPath('userData'));
45
46 // Use source maps in stack traces.
47 enableStacktraceSourceMaps(); 44 enableStacktraceSourceMaps();
48} 45}
49 46
@@ -67,7 +64,7 @@ app.setAboutPanelOptions({
67 `Electron: ${process.versions.electron}`, 64 `Electron: ${process.versions.electron}`,
68 `Chrome: ${process.versions.chrome}`, 65 `Chrome: ${process.versions.chrome}`,
69 `Node.js: ${process.versions.node}`, 66 `Node.js: ${process.versions.node}`,
70 `Platform: ${osName()}`, 67 `Platform: ${os.platform()} ${os.release()}`,
71 `Arch: ${os.arch()}`, 68 `Arch: ${os.arch()}`,
72 `Build date: ${new Date( 69 `Build date: ${new Date(
73 Number(import.meta.env.BUILD_DATE), 70 Number(import.meta.env.BUILD_DATE),