fix: database created at userData path, not bundled in release
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -27,12 +27,8 @@
|
||||
"files": [
|
||||
"dist/**/*",
|
||||
"dist-electron/**/*",
|
||||
"database/**/*",
|
||||
"package.json"
|
||||
],
|
||||
"extraResources": [
|
||||
{ "from": "database/", "to": "database/" }
|
||||
],
|
||||
"win": {
|
||||
"target": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user