Skip to content

fix: stop self-updates from recreating the desktop shortcut - #1082

Open
tunaseckin wants to merge 1 commit into
Polyfrost:mainfrom
tunaseckin:fix/keep-desktop-shortcut-deleted
Open

tunaseckin wants to merge 1 commit into
Polyfrost:mainfrom
tunaseckin:fix/keep-desktop-shortcut-deleted

Conversation

@tunaseckin

Copy link
Copy Markdown
Contributor

Self-updates on Windows run the NSIS installer in passive mode (/P /R). In passive or silent mode, cargo-packager's installer template creates the desktop and start menu shortcuts unless it gets /NS:

IfSilent check_ns_flag 0
${IfThen} $PassiveMode == 1 ${|} Goto check_ns_flag ${|}
...
check_ns_flag:
  ${GetOptions} $CMDLINE "/NS" $R0
  IfErrors 0 shortcuts_done
    Call CreateDesktopShortcut
    Call CreateStartMenuShortcut

So every update put the desktop icon back, even if the user had deleted it. This passes /NS through WindowsConfig::installer_args. The first install still offers the desktop shortcut on its finish page. An update doesn't remove the start menu shortcut, so skipping its creation leaves the existing one alone.

I couldn't test an actual update on Windows. The behaviour comes from reading the installer template and cargo-packager-updater 0.2.3, which appends installer_args after the install mode's /P /R.

Fixes #970

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Desktop icon re-appears after every update

1 participant