From d37789ce7afdf9936097cca0c853dba400a624a0 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Wed, 8 Feb 2023 21:03:40 +0100 Subject: [PATCH] :wrench: Tweak migration code --- src/migrate.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/migrate.js b/src/migrate.js index b22a156..c13fbcc 100644 --- a/src/migrate.js +++ b/src/migrate.js @@ -24,9 +24,20 @@ function migrate() { .then(r => { utils.debug('Starting Burn-My-Windows profile migration!'); + // The default value of this is false, so if it is not present, only normal windows + // were affected. + const onlyNormalWindows = !r.includes('destroy-dialogs=true'); + if (onlyNormalWindows) { + utils.debug('Only normal windows will be burned by the new profile(s).'); + } else { + utils.debug('Normal windows and dialogs will be burned by the new profile(s).'); + } + // Remove some unnecessary lines. r = r.replace(/^active-profile=.*\n?/gm, ''); r = r.replace(/^test-mode=.*\n?/gm, ''); + r = r.replace(/^last-version=.*\n?/gm, ''); + r = r.replace(/^destroy-dialogs=.*\n?/gm, ''); r = r.replace(/^.*-preview-.*\n?/gm, ''); r = r.replace('[/]\n', ''); @@ -66,15 +77,6 @@ function migrate() { utils.debug('Two profiles are required.'); } - // The default value of this is false, so if it is not present, only normal windows - // were affected. - const onlyNormalWindows = !r.includes('destroy-dialogs=true'); - if (onlyNormalWindows) { - utils.debug('Only normal windows will be burned by the new profile(s).'); - } else { - utils.debug('Normal windows and dialogs will be burned by the new profile(s).'); - } - const profile = lines.filter(l => !l.includes('-close-effect=') && !l.includes('-open-effect=')); profile.unshift('[burn-my-windows-profile]');