I have a Mac electron app that calls a compiled binary that I wrote when a button is pressed. The way I have it set up is:
The binary (let's call it
test
) is placed in abin
folder, which sits in the root directory of the application.From a Javascript file, I run
var appRootDir = require('app-root-path');
var path = appRootDir + '/bin/test';
const spawn = require( 'child_process' ).spawn;
var child = spawn( path, []);
whenever I want to start the binary This works great when I run the app locally via npm start
. But, when I package it by running electron-builder
, the binary fails to get called. I don't have this problem on Windows because electron-builder
creates a folder containing the app and its files, but on Mac, everything seems to be condensed into one application. I've tried following this example but it seems specific to ffmpeg/I couldn't get it to work.
Clearly I must be missing something--does anyone have any ideas? Thank you!