You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021
  1. const fs = require('fs');
  2. const path = require('path');
  3. const pathFile = path.join(__dirname, 'path.txt');
  4. function getElectronPath () {
  5. let executablePath;
  6. if (fs.existsSync(pathFile)) {
  7. executablePath = fs.readFileSync(pathFile, 'utf-8');
  8. }
  9. if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
  10. return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron');
  11. }
  12. if (executablePath) {
  13. return path.join(__dirname, 'dist', executablePath);
  14. } else {
  15. throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');
  16. }
  17. }
  18. module.exports = getElectronPath();