How to test platform dependent resource binaries in development? (not native node modules)


I am working on an application that requires platform specific binaries included as resources. Not talking about native node modules, but bundling some precompiled native binaries for child_process execution.

So I have my platform-specific binaries compiled and ready to be included during packaging. Get that far. What I am unclear on is how, during application development, I can call the proper binary for the development platform.

Setting up the problem as I see it:

In my package.json I have:

"scripts": {
    "start": "electron ./app"

That runs the app:


starting with my ./app/main.js. At runtime, when I look at process.resourcesPath that obviously points to:


That makes sense to me, but obviously that’s not gonna do me any good if I try to use locate the development path of my platform binaries.

I can look at:


and build the path relative to my main.js that would work but I’d need a way to know that I was running in development mode aka running inside and not my packaged app.

Is there a way to determine if I am running in vs my packaged app?

Off the top of my head I was looking at:


thinking maybe that would be the proper flag to examine at runtime.

Failing that I suppose I could also set an environment variable at npm start time, something like APP_RESOURCE_PATH . If that is set I use it, if not I fall back to process.resourcesPath. My plan at the moment is to bundle the platform binaries into the apps resources, so that should also do the trick.

My final question then would be:

Am I missing something obvious or is this the only way to handle this problem?


Did you ever find a good solution to this problem? I’m just getting started with Electron and this already has me stumped. I don’t want to go too far into one direction only to find out I didn’t do it the canonical way.


I never did unfortunately. I also got swamped with other projects through
the new year so i won’t be able to pick up my investigation until then.