Stage unpacked the new app to /Applications/.magpie-update/app/magpie.app
and Install moved the old one to .magpie-update/old.app. LaunchServices
registers a folder ending in .app in /Applications within seconds, and
Install only deleted the folder, so Spotlight kept listing the gone path
as another magpie.
- Stage ditto's the zip (one top folder, magpie.app, checked against the
real v0.1.2119 zip: no FinderInfo bundle bit, no __MACOSX) into
.magpie-update/unzip and renames magpie.app to .magpie-update/payload
at once, then has lsregister -u forget the unzip path in case it was
seen in that moment. codesign verifies a bundle named payload the same
(checked on the real zip: verify ok, a tampered copy fails).
- Install and InstallAsAdmin move the old app to <stage>/old, and remove
filepath.Dir(staged), which is still .magpie-update (or the cache's
update folder on the admin path); renames stay on one volume.
- ForgetOldStaging runs once from the GUI's updater start, in a
goroutine: lsregister -u on .magpie-update/app/magpie.app and
.magpie-update/old.app beside the app and in ~/Library/Caches/magpie/
update. lsregister is /System/Library/Frameworks/CoreServices.framework/
Frameworks/LaunchServices.framework/Support/lsregister (present on
macOS 27.2); failures are ignored, a 10s cap, marker in magpie's cache.
/Volumes/magpie (an old DMG) is left alone.
Run at this head (base ffa07395e):
- mote (macOS 27.2): gofmt -l clean; go build, GOOS=windows go build,
GOOS=linux go build -tags nogui; go vet, GOOS=windows go vet and
GOOS=linux go vet -tags nogui on internal/update, internal/gui,
internal/cli; go test internal/update internal/gui internal/proc
internal/appdir: build and vet ok;
update, proc, appdir ok; gui FAIL only in TestMainWindowCorners/
macOS_26_SDK (the titlebar toolbar on macOS 27), already filed as
#3949 and not in code this touches
- win-run (xiaomi-gpu, Windows 11): go test ./internal/update ok.
- wsl-run (magpie-desktop): go test ./internal/update ok.
- Real LaunchServices on mote, a fake bundle id (com.example...) in
/Applications/lstest-3965, not magpie.app: the old flow by hand
registered .magpie-update/app/magpie.app within 30s and kept it after
the folder was deleted. A throwaway test running this Stage + Install
with the real lsregister: after 45s staged and 15s installed,
lsregister -dump shows only lstest-3965/magpie.app; with stagedName
set back to magpie.app the same run shows .magpie-update/magpie.app
registered (red). ForgetOldStaging with the real lsregister removed
both registered .magpie-update paths after their folders were deleted.
Everything registered was unregistered and the folder removed.
Broken by hand, each red: asideName "old.app" (TestInstallAsAdminAside-
IsNoApp), stagedName "magpie.app" (TestInstallStagesNoApp, TestStage-
UnpacksNoApp), RemoveAll two folders up as before (TestInstallStagesNoApp:
the Applications folder went with it), no unregister of the unzip path
(TestStageUnpacksNoApp), no marker (TestForgetOldStaging).
Not tried: a real magpie update of the installed /Applications/magpie.app
with Spotlight's UI (the fake bundle stood in), the administrator-password
path for real, the full go test ./... suite.