Skip to content

In a project, it is often necessary to call (open) third-party software, such as exe, bash scripts, dll libraries, etc.

Extra Resources Directory

bash
./build/extraResources

Internal Logic

  • When generating the software, the extra resources directory is bundled into the software installation package
  • After software installation, resources are extracted to: software installation location/resources/extraResources

Usage

javascript
# Resource paths differ before and after packaging

const { getExtraResourcesDir } = require('ee-core/ps');
# getExtraResourcesDir() automatically determines whether it is before or after packaging
let softwarePath = '';
softwarePath = path.join(getExtraResourcesDir(), softName);

# A demo is already in the project, please check it
# Method One
/**
 * Call other programs
 */
openSoftware (softName) {
  .......
}

# Method Two
The framework provides a cross module, offering cross-platform APIs to call third-party programs

Example Description

powershell.exe software location in the demo

bash
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

# Put it into the ./build/extraResources resource directory and test