From 73c100d74792a809d5fcdbe27f5328815ae7351c Mon Sep 17 00:00:00 2001 From: Branza Alexandru Date: Sun, 16 Aug 2015 01:08:22 -0700 Subject: [PATCH] Fix Update Window 2 --- src/lib/update.js | 10 +++++++--- src/updater.html | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/update.js b/src/lib/update.js index 34abbf67..c4783b0e 100644 --- a/src/lib/update.js +++ b/src/lib/update.js @@ -8,12 +8,16 @@ function checkUpdates() { $("#update-header").html("Update to Powder v"+xhr); var updater = gui.Window.open('app://powder/src/updater.html',{ width: 320, height: 133, icon: "icon.png", toolbar: false }); - + if (isWin) updExt = ".exe"; + else { + if (process.platform == "darwin") var updExt = ".dmg"; + else if (process.platform == "linux") var updExt = ".tar.gz"; + } updater.on('close', function() { - fs.stat(gui.App.dataPath+pathBreak+'updater.exe', function(err,stat) { + fs.stat(gui.App.dataPath+pathBreak+'updater'+updExt, function(err,stat) { if (err == null) { if (localStorage.doUpdate == "1") win.close(); - else fs.unlink(gui.App.dataPath+pathBreak+'updater.exe'); + else fs.unlink(gui.App.dataPath+pathBreak+'updater'+updExt); } }); updater.close(true); diff --git a/src/updater.html b/src/updater.html index 9aa19b10..c0dcc421 100644 --- a/src/updater.html +++ b/src/updater.html @@ -54,7 +54,8 @@

Downloaded Successfully

var request = require('request'), gui = require('nw.gui'), - fs = require('fs'); + fs = require('fs'), + file_url; var https = require('https'); @@ -84,6 +85,7 @@

Downloaded Successfully

} } } + if (!file_url) win.close(); }); });