I'm creating an Electron GUI that needs to calls an executable file that takes command line arguments.
I've included the executable in public/libs/internalTool.exe
of the project folder structure. Now I want to use it in the application as such (simpified to only relevant parts):
import { remote } from 'electron';
const fs = remote.require('fs');
const path = remote.require('path');
const childProcess = remote.require('child_process');
export function processFile(inputFilePath: string, outputFilePath: string): void {
const internalToolPath = 'libs/internalTool.exe';
const inputDir = path.parse(inputFilePath).dir;
const outputDir = path.join(unencryptedDir, 'encrypted');
childProcess.execSync(`${internalToolPath} ${inputFilePath} ${outputFilePath}`);
}
However, when I call this function it says that libs/internalTool.exe
does not exist and it doesn't run the command. How can I reference this exe properly in my code?