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