@@ -3,29 +3,34 @@ import { remote } from 'electron';
3
3
import { environment } from '../../../environments/environment' ;
4
4
5
5
export class Settings {
6
+ public static dbFolder : string ;
7
+ public static dbPath : string ;
8
+ public static appPath : string ;
9
+ private static dataSubFolder : string ;
10
+ private static dbName = 'database.db' ;
6
11
7
- public static dbFolder : string ;
8
- public static dbPath : string ;
9
- public static appPath : string ;
10
- private static dataSubFolder : string ;
11
- private static dbName = 'database.db' ;
12
+ public static initialize ( ) : void {
13
+ Settings . getPaths ( ) ;
14
+ }
12
15
13
- public static initialize ( ) : void {
14
- Settings . getPaths ( ) ;
16
+ private static getPaths ( ) {
17
+ if ( environment . production ) {
18
+ this . dataSubFolder = '/' ;
19
+ Settings . appPath = remote . app . getPath ( 'userData' ) ;
20
+ } else {
21
+ // return folder where app is running
22
+ this . dataSubFolder = 'dist/assets/data' ;
23
+ Settings . appPath = remote . app . getAppPath ( ) ;
15
24
}
16
25
17
- private static getPaths ( ) {
18
-
19
- if ( environment . production ) {
20
- this . dataSubFolder = '/' ;
21
- Settings . appPath = remote . app . getPath ( 'userData' ) ;
22
- } else {
23
- // return folder where app is running
24
- this . dataSubFolder = 'dist/assets/data' ;
25
- Settings . appPath = remote . app . getAppPath ( ) ;
26
- }
27
-
28
- Settings . dbFolder = path . join ( Settings . appPath , Settings . dataSubFolder ) ;
29
- Settings . dbPath = path . join ( Settings . dbFolder , this . dbName )
30
- }
31
- }
26
+ Settings . dbFolder = path . join (
27
+ Settings . appPath ,
28
+ Settings . dataSubFolder
29
+ ) ;
30
+ Settings . dbPath = path . join ( Settings . dbFolder , this . dbName ) ;
31
+ console . log (
32
+ '[Settings] Database is located at ' ,
33
+ Settings . dbPath
34
+ ) ;
35
+ }
36
+ }
0 commit comments