const fs = require('fs');
const path = require('path');

const pathFile = path.join(__dirname, 'path.txt');

function getElectronPath () {
  if (fs.existsSync(pathFile)) {
    const executablePath = fs.readFileSync(pathFile, 'utf-8');
    if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
      return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath);
    }
    return path.join(__dirname, 'dist', executablePath);
  } else {
    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');
  }
}

module.exports = getElectronPath();

@@ -132,16 +132,38 @@
 th () %7B%0A
+  let executablePath;%0A
   if (fs
@@ -191,22 +191,16 @@
 ) %7B%0A    
-const 
 executab
@@ -246,16 +246,18 @@
 -8');%0A  
+%7D%0A
   if (pr
@@ -301,18 +301,16 @@
 ) %7B%0A    
- 
- 
 return p
@@ -377,16 +377,52 @@
 Path
-);%0A    %7D
+ %7C%7C 'electron');%0A  %7D%0A  if (executablePath) %7B
 %0A   

allow path override with --ignore-scripts (#25377)