podman-desktop/buildResources/installer.nsh
Charlie Drage 514aa7f651
fix(windows uninstall): use dynamic product name for Windows registry cleanup (#15845)
fix(nsis): use dynamic product name for Windows registry cleanup

### What does this PR do?

Replaces hardcoded "Podman Desktop" string with `${PRODUCT_NAME}` variable
in the NSIS uninstaller script for registry key deletion.

### Why is this needed?

The auto-start registry entry is created by Electron using the productName
from the build config:

```typescript
// windows-startup.ts:86-90
app.setLoginItemSettings({
  openAtLogin: true,
  path: `"${this.podmanDesktopBinaryPath}"`,
  args,
});
```

The productName comes from:

```javascript
// .electron-builder.config.cjs:109
productName: product.name,
```

```json
// product.json:3
"name": "Podman Desktop",
```

electron-builder automatically defines `PRODUCT_NAME` for NSIS scripts
already (https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts#L210):

```nsis
// installer.nsh:4-5
DeleteRegValue HKCU "...\Run" "${PRODUCT_NAME}"
DeleteRegValue HKCU "...\StartupApproved\Run" "${PRODUCT_NAME}"
```

### How to test this PR?

1. Build and install Podman Desktop on Windows
2. Enable "Start on login" in preferences
3. Uninstall the application
4. Verify registry keys are removed from:
   - `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`
   - `HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run`

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 17:04:41 +00:00

6 lines
266 B
Text

!macro customUnInit
; Remove startup registry entry
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_NAME}"
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run" "${PRODUCT_NAME}"
!macroend