Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that default file/protocol handlers are re-installed after updating. #997

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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