diff --git a/electron/main/ipc.ts b/electron/main/ipc.ts index 43fb229..b5a3469 100644 --- a/electron/main/ipc.ts +++ b/electron/main/ipc.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, ipcMain, dialog as dialogBox } from 'electron' +import { BrowserWindow, ipcMain, dialog as dialogBox, app } from 'electron' import { captureScreen, closeScreenshot, getCapturedImage, getCapturedBase64, clearCapturedImage, startScreenshot } from './screenshot' import { getMainWindow, openDialogWindow } from './window' import * as fs from 'fs' @@ -33,7 +33,8 @@ let db: any = null function getDb() { if (!db) { const Database = require('better-sqlite3') - db = new Database('grading.db') + const dbPath = require('path').join(app.getPath('userData'), 'grading.db') + db = new Database(dbPath) db.prepare(`CREATE TABLE IF NOT EXISTS history ( id INTEGER PRIMARY KEY AUTOINCREMENT, question_id INTEGER, diff --git a/package.json b/package.json index 48c8fa1..87609e8 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,8 @@ "files": [ "dist/**/*", "dist-electron/**/*", - "database/**/*", "package.json" ], - "extraResources": [ - { "from": "database/", "to": "database/" } - ], "win": { "target": [ {