Skip to content

Commit 5406083

Browse files
committed
fix(main: db): migrate after move storage
1 parent ebd9f29 commit 5406083

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/services/db/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ const DEFAULT_FOLDER = {
2323
updatedAt: new Date().valueOf()
2424
}
2525

26-
const fileDb = store.preferences.get('storagePath') + `/${DB_NAME}`
26+
const getFileDb = () => {
27+
return store.preferences.get('storagePath') + `/${DB_NAME}`
28+
}
2729

2830
export const createDb = () => {
31+
const fileDb = getFileDb()
32+
2933
if (fs.existsSync(fileDb)) {
3034
return
3135
} else {
@@ -47,6 +51,7 @@ export const createDb = () => {
4751
}
4852

4953
const writeToFile = (db: object) => {
54+
const fileDb = getFileDb()
5055
const data = JSON.stringify(db, null, 2)
5156
fs.writeFileSync(fileDb, data)
5257
}

0 commit comments

Comments
 (0)