electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

[NSIS] After adding 'nsis.menuCategory' in config, an upgrade will still install app to old path

Open Agritite opened this issue 6 months ago • 0 comments

  • Electron-Builder Version: 24.10.0
  • Node Version: 18
  • Electron Version: 28.3.3
  • Electron Type (current, beta, nightly): current
  • Target: nsis

In the latest version of our app we added nsis.menuCategory property in our electron.builder.config, and as expected the install path (per-machine installation) should change as such: C:\Program Files\<APPNAME> to C:\Program Files\<CATEGORY_NAME>\<APPNAME>. However this is only the case for new installs; for upgrades it still installs to C:\Program Files\<APPNAME>. I found this code seems to be the culprit:

https://github.com/electron-userland/electron-builder/blob/b8d6905582b28a9b36f11308f9a72ebc32dc2c86/packages/app-builder-lib/templates/nsis/multiUser.nsh#L68-L84

Can anyone confirm this is intended behavior?

Personally I think the installer shouldn't care where the previous $INSTDIR is? Since we're not doing in-place upgrade, just invoke the old installer while preserving appdata, then install the new version and all is well.

Agritite avatar Aug 12 '24 08:08 Agritite