Skip to content

Commit 6a033c4

Browse files
committed
packaging/windows: route install-time autostart through --configure-autostart
The installer's "Start aMule when I log in" Components-page section now calls `amule.exe --configure-autostart on` via ExecWait instead of writing the HKCU Run key directly. Puts the install-time path and the Preferences → General checkbox through the same AutostartManager API — OS-specific store details (HKCU Run on Windows today; macOS LaunchAgent / Linux XDG .desktop on those targets in the future) live in exactly one place. Uninstaller's autostart cleanup left as-is: it has a safety check that only deletes the Run value if it still points inside $INSTDIR, so a user's hand-set value with a different path survives uninstall. A blind `--configure-autostart off` would regress that check; not worth losing for the symmetry. UAC caveat preserved from the prior direct write: HKCU resolves to the elevated context's hive — if a non-admin user enters a different admin's password at UAC, the entry goes to that admin's HKCU instead of the asker's. Fixing cleanly needs the UAC.dll plugin which isn't worth pulling in for an opt-in single-machine convenience.
1 parent d305939 commit 6a033c4

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

packaging/windows/installer.nsi

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,18 @@ Section "Desktop shortcut" SecDesktop
240240
"$INSTDIR\bin\amule.exe" "" "$INSTDIR\bin\amule.exe" 0
241241
SectionEnd
242242

243-
; HKCU (per-user) so each user on a shared machine opts in independently.
243+
; Delegate to the same code path the Preferences → General checkbox
244+
; uses. AutostartManager owns the OS-specific store (HKCU Run on
245+
; Windows today; macOS LaunchAgent / Linux XDG .desktop on those
246+
; targets), so this section stays one line regardless of which
247+
; backend evolves how. Caveat preserved from the prior direct
248+
; WriteRegStr: HKCU resolves to the elevated context's hive — if a
249+
; non-admin user enters a different admin's password at UAC, the
250+
; entry goes to that admin's HKCU. Same behavior as before; fixing
251+
; it cleanly needs the UAC.dll plugin which isn't worth pulling in
252+
; for an opt-in single-machine convenience.
244253
Section /o "Start aMule when I log in" SecAutostart
245-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" \
246-
"aMule" '"$INSTDIR\bin\amule.exe"'
254+
ExecWait '"$INSTDIR\bin\amule.exe" --configure-autostart on'
247255
SectionEnd
248256

249257
; Component descriptions surfaced on the Components page.

0 commit comments

Comments
 (0)