allow rebuilds. fixes #78

This commit is contained in:
Mathias Buus 2015-12-09 16:16:56 +01:00
parent 90f113cd90
commit 3ce46663b9

View file

@ -9,6 +9,13 @@ var path = require('path')
var extract = require('extract-zip')
var download = require('electron-download')
var installedVersion = null
try {
installedVersion = fs.readFileSync(path.join(__dirname, 'dist', 'version'), 'utf-8').replace(/^v/, '')
} catch (err) {
// do nothing
}
var platform = os.platform()
function onerror (err) {
@ -23,6 +30,10 @@ var paths = {
if (!paths[platform]) throw new Error('Unknown platform: ' + platform)
if (installedVersion === version && fs.existsSync(paths[platform])) {
return
}
// downloads if not cached
download({version: version, arch: process.env.npm_config_arch}, extractFile)