vy.pham
vy.pham

Reputation: 611

how to run commandline in electron after build with ASAR

child_process code like bellow

var child_process = require('child_process');
child_process.execFile(path.join(__dirname,'./run/start.bat'))

i have config in package.json like this

"extraResources": [
      {
        "from": "./run",
        "to": "run"
      }
    ],

after build with electron-builder, in folder resources i have 2 file electron.asar and app.asar and folder run. but it not execFile start.bat after build. running in dev is working good

Upvotes: 1

Views: 1220

Answers (1)

tpikachu
tpikachu

Reputation: 4854

  process.env.NODE_ENV === 'development'
? path.join(__dirname,'./run/start.bat')
: path.join(process.resourcesPath, 'run/start.bat');

Upvotes: 1

Related Questions