Skip to content

Commit

Permalink
Skip update on linux if not in AppImage.
Browse files Browse the repository at this point in the history
Also add some nicer error handling.
  • Loading branch information
Paul Gebheim committed Aug 20, 2018
1 parent 75a3129 commit f0f0de1
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/update/check-for-updates.js
@@ -1,4 +1,4 @@
const {app, dialog, shell} = require('electron')
const {app, dialog, shell } = require('electron')
const {autoUpdater} = require('electron-updater')
const ProgressBar = require('electron-progressbar')
const log = require('electron-log')
Expand Down Expand Up @@ -65,6 +65,7 @@ autoUpdater.autoDownload = false

module.exports = (notifyUpdateNotAvailable = false) => {
if(isDev) return Promise.resolve()
if(process.platform == "linux" && !process.env.APPIMAGE) return Promise.resolve()

const p = new Promise((resolve) => {
autoUpdater
Expand All @@ -79,15 +80,11 @@ module.exports = (notifyUpdateNotAvailable = false) => {
.once('update-not-available', notifyNoUpdate)


return autoUpdater.checkForUpdates().catch((e) => {
log.error('There was an error updating app. This is expected if using deb package.')

try {
autoUpdater.checkForUpdates()
} catch(e) {
log.error('There was an error updating app. This is expected if using deb package.', e);
return Promise.resolve(p);
});

// Kickoff the app.
return Promise.resolve()
}

return p
return p;
}

0 comments on commit f0f0de1

Please sign in to comment.