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 2, 2016
1 parent 46d5c9c commit 5dc18f9
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 @@ -43,10 +43,23 @@ function run (state) {
migrate_0_17_0(state.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 handlers = require('../../main/handlers')
handlers.install()
}
}

function migrate_0_7_0 (saved) {
const fs = require('fs-extra')
const path = require('path')
Expand Down

0 comments on commit 5dc18f9

Please sign in to comment.