From bcbe1678f149c0b783d0df43ff73efa8d09ae152 Mon Sep 17 00:00:00 2001 From: gsx <530353222@qq.com> Date: Sat, 19 Mar 2022 18:49:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B5=84=E6=BA=90=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/controller/example.js | 18 ++++++++++-------- electron/preload/index.js | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/electron/controller/example.js b/electron/controller/example.js index 134a598..3f94cb0 100644 --- a/electron/controller/example.js +++ b/electron/controller/example.js @@ -418,14 +418,16 @@ class ExampleController extends Controller { } // 资源路径不同 - let softwarePath = ''; - if (electronApp.isPackaged) { - // 打包后 execDir为 应用程序 exe\dmg\dep软件所在目录;打包前该值是项目根目录 - softwarePath = path.join(this.app.config.execDir, "resources", "extraResources", softName); - } else { - // 打包前 - softwarePath = path.join(this.app.config.execDir, "build", "extraResources", softName); - } + // let softwarePath = ''; + // if (electronApp.isPackaged) { + // // 打包后 execDir为 应用程序 exe\dmg\dep软件所在目录;打包前该值是项目根目录 + // softwarePath = path.join(this.app.config.execDir, "resources", "extraResources", softName); + // } else { + // // 打包前 + // softwarePath = path.join(this.app.config.execDir, "build", "extraResources", softName); + // } + let softwarePath = path.join(Utils.getExtraResourcesDir(), softName); + this.app.logger.info('[openSoftware] softwarePath:', softwarePath); // 检查程序是否存在 if (!fs.existsSync(softwarePath)) { diff --git a/electron/preload/index.js b/electron/preload/index.js index 4d9f0d6..b9413e4 100644 --- a/electron/preload/index.js +++ b/electron/preload/index.js @@ -11,6 +11,7 @@ const awaken = require('../library/awaken'); /** * 预加载模块入口 + * @param {Object} app - 全局app对象 */ module.exports = async (app) => {