Skip to content

Commit

Permalink
Ensure that default file/protocol handlers are re-installed after upd…
Browse files Browse the repository at this point in the history
…ating.

Previously, they were only installed when the preference was changed.
This caused the handlers to point to non-existing files after updates
occurred and older versions were removed by Squirrel.

Closes #791, #911.
  • Loading branch information
bnjmnt4n committed Oct 6, 2016
1 parent b0b6069 commit 39145b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/renderer/lib/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,23 @@ function run (state) {
if (semver.lt(version, '0.17.0')) migrate_0_17_0(saved)
if (semver.lt(version, '0.17.2')) migrate_0_17_2(saved)

if (semver.lt(version, config.APP_VERSION)) {
installHandlers(state.saved)
}

// Config is now on the new version
state.saved.version = config.APP_VERSION
}

// Whenever the app is updated, re-install default handlers if the user has
// enabled them.
function installHandlers (saved) {
if (saved.prefs.isFileHandler) {
const ipcRenderer = require('electron').ipcRenderer
ipcRenderer.send('setDefaultFileHandler', true)
}
}

function migrate_0_7_0 (saved) {
const cpFile = require('cp-file')
const path = require('path')
Expand Down

0 comments on commit 39145b2

Please sign in to comment.