优化软件调用

This commit is contained in:
gaoshuaixing
2022-03-03 17:22:06 +08:00
parent fbed1a3ced
commit a3fc922e86
2 changed files with 6 additions and 5 deletions

View File

@@ -38,8 +38,8 @@ class ExampleController extends Controller {
async test () {
const result = await this.service.example.test('electron');
// let tmpDir = Utils.getLogDir();
// console.log('tmpDir:', tmpDir);
let tmpDir = Utils.getLogDir();
console.log('tmpDir:', tmpDir);
return result;
}
@@ -421,11 +421,12 @@ class ExampleController extends Controller {
let softwarePath = '';
if (electronApp.isPackaged) {
// 打包后
softwarePath = path.join(electronApp.getAppPath(), "..", "extraResources", softName);
softwarePath = path.join(this.app.config.execDir, "resources", "extraResources", softName);
} else {
// 打包前
softwarePath = path.join(electronApp.getAppPath(), "build", "extraResources", softName);
softwarePath = path.join(this.app.config.execDir, "build", "extraResources", softName);
}
// 检查程序是否存在
if (!fs.existsSync(softwarePath)) {
return false;

View File

@@ -7,7 +7,7 @@
<p/>
<span class="sub-content">
请先将powershell.exe复制到electron-egg/build/extraResources目录中
</span>
</span>
</div>
<div class="one-block-2">
<a-list bordered :data-source="data">