diff options
author | 2021-09-22 19:48:16 +0530 | |
---|---|---|
committer | 2021-09-22 19:48:16 +0530 | |
commit | 2ac8beeeb0664b9c1e166cacddd0d0e8bea9b317 (patch) | |
tree | edcfd3fce49e8c8a19ccf63606e8dce01fbcc90b | |
parent | 5.6.3-nightly.10 [skip ci] (diff) | |
download | ferdium-app-2ac8beeeb0664b9c1e166cacddd0d0e8bea9b317.tar.gz ferdium-app-2ac8beeeb0664b9c1e166cacddd0d0e8bea9b317.tar.zst ferdium-app-2ac8beeeb0664b9c1e166cacddd0d0e8bea9b317.zip |
fix: fix some ts errors
-rw-r--r-- | @types/index.d.ts | 12 | ||||
-rw-r--r-- | src/environment.ts | 10 |
2 files changed, 14 insertions, 8 deletions
diff --git a/@types/index.d.ts b/@types/index.d.ts index e21f88cee..4bfdb28fc 100644 --- a/@types/index.d.ts +++ b/@types/index.d.ts | |||
@@ -2,8 +2,18 @@ declare global { | |||
2 | interface Window { | 2 | interface Window { |
3 | ferdi: any; | 3 | ferdi: any; |
4 | } | 4 | } |
5 | } | ||
6 | 5 | ||
6 | namespace NodeJS { | ||
7 | interface ProcessEnv { | ||
8 | GITHUB_AUTH_TOKEN: string; | ||
9 | NODE_ENV: 'development' | 'production'; | ||
10 | FERDI_APPDATA_DIR?: string; | ||
11 | PORTABLE_EXECUTABLE_DIR?: string; | ||
12 | ELECTRON_IS_DEV?: string; | ||
13 | APPDATA?: string; | ||
14 | } | ||
15 | } | ||
16 | } | ||
7 | /** | 17 | /** |
8 | * Workaround to make TS recognize this file as a module. | 18 | * Workaround to make TS recognize this file as a module. |
9 | * https://fettblog.eu/typescript-augmenting-global-lib-dom/ | 19 | * https://fettblog.eu/typescript-augmenting-global-lib-dom/ |
diff --git a/src/environment.ts b/src/environment.ts index ca1380199..b51b0aae1 100644 --- a/src/environment.ts +++ b/src/environment.ts | |||
@@ -38,15 +38,11 @@ export const ferdiLocale = app.getLocale(); | |||
38 | // Set app directory before loading user modules | 38 | // Set app directory before loading user modules |
39 | if (process.env.FERDI_APPDATA_DIR != null) { | 39 | if (process.env.FERDI_APPDATA_DIR != null) { |
40 | app.setPath('appData', process.env.FERDI_APPDATA_DIR); | 40 | app.setPath('appData', process.env.FERDI_APPDATA_DIR); |
41 | app.setPath('userData', join(app.getPath('appData'))); | 41 | app.setPath('userData', app.getPath('appData')); |
42 | } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { | 42 | } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { |
43 | app.setPath( | 43 | app.setPath('appData', join(process.env.PORTABLE_EXECUTABLE_DIR, `${app.name}AppData`)); |
44 | 'appData', | ||
45 | process.env.PORTABLE_EXECUTABLE_DIR, | ||
46 | `${app.name}AppData`, | ||
47 | ); | ||
48 | app.setPath('userData', join(app.getPath('appData'), `${app.name}AppData`)); | 44 | app.setPath('userData', join(app.getPath('appData'), `${app.name}AppData`)); |
49 | } else if (is.windows) { | 45 | } else if (is.windows && process.env.APPDATA != null) { |
50 | app.setPath('appData', process.env.APPDATA); | 46 | app.setPath('appData', process.env.APPDATA); |
51 | app.setPath('userData', join(app.getPath('appData'), app.name)); | 47 | app.setPath('userData', join(app.getPath('appData'), app.name)); |
52 | } | 48 | } |