@XBJNTMs2mDbsvPH on X: on Windows magpie ran from wherever the
downloaded exe was and updated itself in place there, so deleting the
download deleted magpie, and opening copies of different versions left
several Magpie entries in the Start menu.
Cause: update.Settle installed the exe into %LOCALAPPDATA%\Programs\magpie
only when it ran from the known Downloads or Desktop folder or a temp
folder. A browser set to save elsewhere (D:\下载), or a download moved
into a folder of the user's own, never counted, so that copy stayed the
app, updated in place, and each copy opened was an app of its own to
Windows (its own path: taskbar, Start's lists, Open at login,
Magpie.lnk repointed at whichever ran last).
Now an exe still named as the site's download
(magpie-windows-amd64.exe, "… (1).exe", arm64; downloadName) counts as a
download wherever it is, but only through the existing install dialog,
never unasked (no dialog, no install). Installed, it opens the installed
copy as a download in Downloads does, and a newer one replaces it.
Cancel on such a copy is kept in HKCU\Software\magpie NotInstalled (the
exe's path): it runs where it is from then on, is not asked again and
never forwards; another copy is still asked. Cancel in Downloads is not
recorded, as before. forwards() (no magpie.com beside a forwarding
copy) follows the same rule. Uninstall's ForgetInstallDir takes the new
value out with InstallLocation. A renamed copy (D:\Tools\magpie.exe)
is left alone as before. No new UI: the dialog is the one from 49c9491b7.
The shortcut code itself makes only one Magpie.lnk and repoints it; it
was not changed.
Tests: TestSettleAsksAboutADownloadKeptElsewhere and
TestSettleDeclinedElsewhereIsKept (fakes, any OS), TestDeclinedRecord
(real HKCU, a key of its own, Windows). TestSettleLeavesAChosenPlace now
uses a renamed copy and checks nothing is asked.
Run:
- win-run (xiaomi-gpu, Windows 11) go test -count=1 ./internal/update/
./internal/uninstall/ ./internal/shortcut/ ./internal/gui/: update,
uninstall, shortcut ok except TestPackagedByDpkg (#4603, untouched);
gui red TestGatewayHeldByAContainer and TestLodyImportHandoff (#6068,
untouched).
- win-run go test -run 'TestSettle|TestDeclinedRecord|TestForward|
TestNoCompanion|TestInstall' -v ./internal/update/: ok.
- Broken by hand on Windows: the name check off -> both new tests red
(settle = "" want the installed; declined ""); the decline record
ignored -> TestSettleDeclinedElsewhereIsKept red ("asked again").
- win-run go vet ./internal/update/ ./internal/uninstall/ ./internal/gui/
and wsl-run go vet -tags nogui ./internal/update/ ./internal/uninstall/
(magpie-desktop, covers install_other.go): clean. gofmt -l clean.
- win-run go test -count=1 . (TestAllLazyPatternsCompile and the other
root guards, the new pattern included): ok.
Not run: the full suite and a darwin vet (mote at load 126-142, mica's
disk full). Not tried: the real app's dialog on an interactive Windows
desktop from a non-Downloads folder (the box's HKCU\Software\magpie and
Start menu are shared with other sessions' magpie there), and the
reporter's duplicate Start entries were not reproduced; which list
showed them is not known.