diff --git a/src/renderer/lib/migrations.js b/src/renderer/lib/migrations.js index 2fad6b1349..341c7824e8 100644 --- a/src/renderer/lib/migrations.js +++ b/src/renderer/lib/migrations.js @@ -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')