Repository navigation
fix(packaging): remove only the Path folder the Windows installer added - #2199
Conversation
|
Thanks for your first pull request! Before it is merged:
|
With windows.command_line, the uninstaller removed every Path entry matching the install folder, including one the user had before installing, and an upgrade to another folder left the old one behind. The installer now records the folder it added as NsgoPathAddedDir in the uninstall entry, only when the folder was not on Path already. An upgrade to the same folder keeps the record; an upgrade to another folder, one that drops windows.command_line, and the uninstaller remove that exact folder and drop the record only once PowerShell reports it gone. A failed removal keeps the record, past the uninstall entry's deletion, and an upgrade then leaves its own folder off Path. An uninstaller left in a folder an upgrade moved from, which InstallLocation no longer names, removes its own files alone. Installations from before the record have none, and their folder stays on Path.
30c31fb to
2421f91
Compare
|
Reviewed. I traced the install, upgrade and uninstall paths through One behaviour to keep in mind: an uninstaller whose uninstall entry has gone entirely (empty |
Why
With
windows.command_line, the NSIS installer adds the app's folder to the user'sPath. Two cases went wrong for apps that use it:Pathbefore installing, for example because the user added it, the uninstaller removed it anyway.Path.What changed
NsgoPathAddedDirin the app's uninstall entry, and only when the folder was not already onPath.windows.command_lineremove that exact folder, and drop the record only once PowerShell reports the folder gone.InstallLocationnow names another folder) removes only its own files. It leaves the active installation's registrations, shortcuts, uninstall entry andPathalone.Scope
nsgotool (NSIS installer generation) and Windows.Tradeoffs
windows.command_lineare affected only by the moved-folder uninstaller guard above.Path. This avoids removing an entry the installer cannot prove it added.Blast Radius
Windows installers built by NSGo. The Path changes apply to apps that set
windows.command_line; the moved-folder uninstaller guard applies to every Windows installer. Other targets are unaffected.Verification
go tool nsgo check,go tool nsgo check -target windows, the changelog check andgo tool nsgo test -run TestNSIS ./cmd/nsgoon macOS.TestNSISCompilesnow also compiles the script withwindows.command_line.New
TestNSISPathOwnershipNativeinfileassociations_windows_test.goinstalls and uninstalls on real Windows against the user'sPath, restoring the previous value and type afterwards. It covers:Pathalone;It runs in the Windows CI job under
NSGO_FILE_ASSOCIATIONSand theNSIStest selector. I could not run it locally, as I have no Windows machine.The failed-removal paths have no native test, since PowerShell cannot be made to fail reliably there.
Checklist: the title is a Conventional Commit; the docs whose facts change are updated; the change has a
changelog.d/fragment; no new third-party code, assets or dependencies.