Inline platform variable
This commit is contained in:
parent
835c64b7b2
commit
ed8260e4d9
1 changed files with 21 additions and 21 deletions
|
@ -16,27 +16,7 @@ try {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
var platform = process.env.npm_config_platform || os.platform()
|
var platformPath = getPlatformPath()
|
||||||
|
|
||||||
function onerror (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPath (platform) {
|
|
||||||
switch (platform) {
|
|
||||||
case 'darwin':
|
|
||||||
return 'dist/Electron.app/Contents/MacOS/Electron'
|
|
||||||
case 'freebsd':
|
|
||||||
case 'linux':
|
|
||||||
return 'dist/electron'
|
|
||||||
case 'win32':
|
|
||||||
return 'dist/electron.exe'
|
|
||||||
default:
|
|
||||||
throw new Error('Electron builds are not available on platform: ' + platform)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var platformPath = getPath(platform)
|
|
||||||
|
|
||||||
if (installedVersion === version && fs.existsSync(path.join(__dirname, platformPath))) {
|
if (installedVersion === version && fs.existsSync(path.join(__dirname, platformPath))) {
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
@ -61,3 +41,23 @@ function extractFile (err, zipPath) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onerror (err) {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPlatformPath () {
|
||||||
|
var platform = process.env.npm_config_platform || os.platform()
|
||||||
|
|
||||||
|
switch (platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'dist/Electron.app/Contents/MacOS/Electron'
|
||||||
|
case 'freebsd':
|
||||||
|
case 'linux':
|
||||||
|
return 'dist/electron'
|
||||||
|
case 'win32':
|
||||||
|
return 'dist/electron.exe'
|
||||||
|
default:
|
||||||
|
throw new Error('Electron builds are not available on platform: ' + platform)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue