From f8528713e6d1997c89316e8501be7d6e62b5695b Mon Sep 17 00:00:00 2001 From: JianMiau Date: Fri, 30 Aug 2024 15:54:25 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20=E5=8B=95=E6=85=8B=E8=AE=80json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 8 +++++++- src/Utils/tools.ts | 5 +++-- src/api/slot/SlotSpinBase.ts | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e571540..2e5cb44 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,13 @@ ], "directories": { "output": "release" - } + }, + "extraFiles": [ + { + "from": "shared", + "to": "resources/shared" + } + ] }, "dependencies": { "dayjs": "^1.11.13", diff --git a/src/Utils/tools.ts b/src/Utils/tools.ts index d582088..32741d8 100644 --- a/src/Utils/tools.ts +++ b/src/Utils/tools.ts @@ -1,4 +1,3 @@ -import { app } from 'electron'; import path from 'path'; export function getExternalJsonPath(filename: string): string { @@ -7,6 +6,8 @@ export function getExternalJsonPath(filename: string): string { return path.join(__dirname, '../../shared/jsons', filename); } else { // 生产模式下使用外部路径 - return path.join(app.getPath('userData'), 'jsons', filename); + const filepath = path.join(__dirname, `../../../shared/jsons/${filename}`); + // console.log('filepath', filepath); + return filepath; } } \ No newline at end of file diff --git a/src/api/slot/SlotSpinBase.ts b/src/api/slot/SlotSpinBase.ts index 65adcda..5b4c73c 100644 --- a/src/api/slot/SlotSpinBase.ts +++ b/src/api/slot/SlotSpinBase.ts @@ -110,7 +110,7 @@ export default abstract class SlotSpinBase { protected async GetTemps(): Promise { const filePath = getExternalJsonPath(`slot${this.ID}.json`); - console.log('filePath', filePath); + // console.log('filePath', filePath); const data = await fs.promises.readFile(filePath, 'utf-8'); const jsonData = JSON.parse(data); return jsonData;