diff options
author | 2021-10-01 13:19:09 +0530 | |
---|---|---|
committer | 2021-10-01 13:19:09 +0530 | |
commit | a5ee51af026f80aec64cd32bdff15ebc2c9a4b0b (patch) | |
tree | 7f8baed412a9a6f24df56447c36c7ac2bd47cc6c | |
parent | fix: Default zoom level is small and increments are huge (#2003) (diff) | |
download | ferdium-app-a5ee51af026f80aec64cd32bdff15ebc2c9a4b0b.tar.gz ferdium-app-a5ee51af026f80aec64cd32bdff15ebc2c9a4b0b.tar.zst ferdium-app-a5ee51af026f80aec64cd32bdff15ebc2c9a4b0b.zip |
refactor: reduce dependency on 'electron-utils' and 'electron-is-dev' (#2005)
-rw-r--r-- | src/environment.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/environment.ts b/src/environment.ts index 92fa41943..818577c1f 100644 --- a/src/environment.ts +++ b/src/environment.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import os from 'os'; | 1 | import os from 'os'; |
2 | import { join } from 'path'; | 2 | import { join } from 'path'; |
3 | 3 | ||
4 | import { is, api as electronApi } from 'electron-util'; | 4 | import { api as electronApi } from 'electron-util'; |
5 | 5 | ||
6 | import { DEFAULT_ACCENT_COLOR } from '@meetfranz/theme'; | 6 | import { DEFAULT_ACCENT_COLOR } from '@meetfranz/theme'; |
7 | 7 | ||
@@ -28,6 +28,10 @@ import { asarPath } from './helpers/asar-helpers'; | |||
28 | // @ts-expect-error Cannot find module './buildInfo.json' or its corresponding type declarations. | 28 | // @ts-expect-error Cannot find module './buildInfo.json' or its corresponding type declarations. |
29 | import * as buildInfo from './buildInfo.json'; | 29 | import * as buildInfo from './buildInfo.json'; |
30 | 30 | ||
31 | export const isMac = process.platform === 'darwin'; | ||
32 | export const isWindows = process.platform === 'win32'; | ||
33 | export const isLinux = process.platform === 'linux'; | ||
34 | |||
31 | export const { app } = electronApi; | 35 | export const { app } = electronApi; |
32 | export const ferdiVersion = app.getVersion(); | 36 | export const ferdiVersion = app.getVersion(); |
33 | export const electronVersion = process.versions.electron; | 37 | export const electronVersion = process.versions.electron; |
@@ -42,12 +46,12 @@ if (process.env.FERDI_APPDATA_DIR != null) { | |||
42 | } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { | 46 | } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { |
43 | app.setPath('appData', join(process.env.PORTABLE_EXECUTABLE_DIR, `${app.name}AppData`)); | 47 | app.setPath('appData', join(process.env.PORTABLE_EXECUTABLE_DIR, `${app.name}AppData`)); |
44 | app.setPath('userData', join(app.getPath('appData'), `${app.name}AppData`)); | 48 | app.setPath('userData', join(app.getPath('appData'), `${app.name}AppData`)); |
45 | } else if (is.windows && process.env.APPDATA != null) { | 49 | } else if (isWindows && process.env.APPDATA != null) { |
46 | app.setPath('appData', process.env.APPDATA); | 50 | app.setPath('appData', process.env.APPDATA); |
47 | app.setPath('userData', join(app.getPath('appData'), app.name)); | 51 | app.setPath('userData', join(app.getPath('appData'), app.name)); |
48 | } | 52 | } |
49 | 53 | ||
50 | export const isDevMode = is.development; | 54 | export const isDevMode = !app.isPackaged; |
51 | if (isDevMode) { | 55 | if (isDevMode) { |
52 | app.setPath('userData', join(app.getPath('appData'), `${app.name}Dev`)); | 56 | app.setPath('userData', join(app.getPath('appData'), `${app.name}Dev`)); |
53 | } | 57 | } |
@@ -68,9 +72,6 @@ export function asarRecipesPath(...segments: any[]) { | |||
68 | export const useLiveAPI = process.env.USE_LIVE_API; | 72 | export const useLiveAPI = process.env.USE_LIVE_API; |
69 | const useLocalAPI = process.env.USE_LOCAL_API; | 73 | const useLocalAPI = process.env.USE_LOCAL_API; |
70 | 74 | ||
71 | export const isMac = is.macos; | ||
72 | export const isWindows = is.windows; | ||
73 | export const isLinux = is.linux; | ||
74 | export const osPlatform = os.platform(); | 75 | export const osPlatform = os.platform(); |
75 | export const osArch = os.arch(); | 76 | export const osArch = os.arch(); |
76 | export const osRelease = os.release(); | 77 | export const osRelease = os.release(); |