Skip to content

Commit 9c8ecb2

Browse files
Andrew AllenAndrew Allen
Andrew Allen
authored and
Andrew Allen
committed
add console message of database location
1 parent b447e28 commit 9c8ecb2

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

src/app/data-access/repositories/settings.ts

+27-22
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,34 @@ import { remote } from 'electron';
33
import { environment } from '../../../environments/environment';
44

55
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';
611

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+
}
1215

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();
1524
}
1625

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

Comments
 (0)