File tree Expand file tree Collapse file tree 4 files changed +31
-8
lines changed
Expand file tree Collapse file tree 4 files changed +31
-8
lines changed Original file line number Diff line number Diff line change 4242/vendor /python_26 /
4343node_modules /
4444SHASUMS256.txt
45- ** /package-lock.json
45+ ** /package-lock.json
46+ ** /yarn.lock
47+
48+ # npm package
49+ /npm /dist
50+ /npm /path.txt
Original file line number Diff line number Diff line change @@ -85,3 +85,13 @@ This environment variable will not work if the `crashReporter` is started.
8585Shows the Windows's crash dialog when Electron crashes.
8686
8787This environment variable will not work if the ` crashReporter ` is started.
88+
89+ ### ` ELECTRON_OVERRIDE_DIST_PATH `
90+
91+ When running from the ` electron ` package, this variable tells
92+ the ` electron ` command to use the specified build of Electron instead of
93+ the one downloaded by ` npm install ` . Usage:
94+
95+ ``` sh
96+ export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/D
97+ ```
Original file line number Diff line number Diff line change @@ -3,8 +3,16 @@ var path = require('path')
33
44var pathFile = path . join ( __dirname , 'path.txt' )
55
6- if ( fs . existsSync ( pathFile ) ) {
7- module . exports = path . join ( __dirname , fs . readFileSync ( pathFile , 'utf-8' ) )
8- } else {
9- throw new Error ( 'Electron failed to install correctly, please delete node_modules/electron and try installing again' )
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+ }
1016}
17+
18+ module . exports = getElectronPath ( )
Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ function getPlatformPath () {
5252
5353 switch ( platform ) {
5454 case 'darwin' :
55- return 'dist/ Electron.app/Contents/MacOS/Electron'
55+ return 'Electron.app/Contents/MacOS/Electron'
5656 case 'freebsd' :
5757 case 'linux' :
58- return 'dist/ electron'
58+ return 'electron'
5959 case 'win32' :
60- return 'dist/ electron.exe'
60+ return 'electron.exe'
6161 default :
6262 throw new Error ( 'Electron builds are not available on platform: ' + platform )
6363 }
You can’t perform that action at this time.
0 commit comments