2

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?

Mike R
  • 302
  • 1
  • 5
  • 14
  • 1
    Possible duplicate of [How can I bundle a precompiled binary with electron](https://stackoverflow.com/questions/38361996/how-can-i-bundle-a-precompiled-binary-with-electron) – Estus Flask Oct 27 '19 at 07:16

0 Answers0