From ed8260e4d9b1ce3be9bee8419a3e733ccbbb5249 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 11:48:14 -0800 Subject: [PATCH] Inline platform variable --- npm/install.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/npm/install.js b/npm/install.js index ea87df88a13b..a0c1d3f0ccd3 100755 --- a/npm/install.js +++ b/npm/install.js @@ -16,27 +16,7 @@ try { // do nothing } -var platform = process.env.npm_config_platform || os.platform() - -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) +var platformPath = getPlatformPath() if (installedVersion === version && fs.existsSync(path.join(__dirname, platformPath))) { 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) + } +}