Skip to content

fix: Windows installer places app in permanent location#76

Merged
jcanizalez merged 2 commits intomainfrom
fix/windows-installer-75
Mar 23, 2026
Merged

fix: Windows installer places app in permanent location#76
jcanizalez merged 2 commits intomainfrom
fix/windows-installer-75

Conversation

@jcanizalez
Copy link
Copy Markdown
Owner

Summary

  • Root cause: artifactName was set at the win level in electron-builder.yml, applying to both nsis and portable targets. Both produced VibeGrid-Setup-{version}.exe — the portable exe overwrote the NSIS installer. The PS1 script downloaded a standalone portable exe instead of the actual installer, so nothing was registered.
  • Moved artifactName to target-specific sections (nsisSetup, portablePortable)
  • Added explicit NSIS config: install wizard, desktop + Start Menu shortcuts
  • PS1 script now verifies installation at %LOCALAPPDATA%\Programs\VibeGrid, adds install dir to user PATH, and reports the install location

Test plan

  • Build Windows targets and verify two distinct artifacts: VibeGrid-Setup-{v}.exe and VibeGrid-Portable-{v}.exe
  • Run install.ps1 — app should install to %LOCALAPPDATA%\Programs\VibeGrid
  • Verify Start Menu shortcut and desktop shortcut are created
  • Close and relaunch from Start Menu or by running VibeGrid in a new terminal
  • Verify temp files are cleaned up after install

Fixes #75

…nu entry

Move artifactName from win level to target-specific sections so the
portable exe no longer overwrites the NSIS installer. Add explicit NSIS
config for desktop/Start Menu shortcuts. PS1 script now verifies
installation and adds install dir to user PATH.

Fixes #75
Copilot AI review requested due to automatic review settings March 23, 2026 18:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Windows installation behavior by ensuring the release publishes distinct NSIS installer vs portable artifacts, and updates the PowerShell installer to validate and surface the real per-user install location.

Changes:

  • Split Windows artifactName into target-specific names so portable no longer overwrites the NSIS installer.
  • Add explicit NSIS configuration to create desktop/Start Menu shortcuts and use a wizard (non-one-click) installer.
  • Update install.ps1 to check installer exit code, verify install at %LOCALAPPDATA%\Programs\VibeGrid, and add the install directory to the user PATH.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
install.ps1 Adds installer exit-code handling, install verification, PATH update, and clearer final output.
electron-builder.yml Separates Windows artifact naming by target and adds NSIS shortcut/install UX configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

install.ps1 Outdated
Comment on lines +52 to +53
if ($UserPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("Path", "$UserPath;$InstallDir", "User")
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When updating the user PATH, concatenating with ";" can create empty PATH entries (e.g., if $UserPath is null/empty, or already ends with ';'), which Windows interprets as the current directory. Consider normalizing PATH entries (split on ';', trim, drop empties), checking for an exact match of $InstallDir, and then re-joining to avoid introducing empty components or substring false-positives.

Suggested change
if ($UserPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("Path", "$UserPath;$InstallDir", "User")
$pathEntries = @()
if ($UserPath) {
$pathEntries = $UserPath -split ';' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
}
if (-not ($pathEntries -contains $InstallDir)) {
$pathEntries += $InstallDir
$newPath = ($pathEntries -join ';')
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9f96bbb — PATH entries are now split, trimmed, and filtered before checking with -contains.

perMachine: false
createDesktopShortcut: true
createStartMenuShortcut: true
shortcutName: VibeGrid
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding shortcutName: VibeGrid can drift from productName if that value ever changes. Since the default shortcut name already follows the product name, consider removing shortcutName (or otherwise deriving it from the existing productName) to keep configuration consistent.

Suggested change
shortcutName: VibeGrid

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 9f96bbb — defaults to productName already.

install.ps1 Outdated
Comment on lines +35 to +48
if ($process.ExitCode -ne 0) {
Write-Error "Installer exited with code $($process.ExitCode)."
exit 1
}

# Verify installation at the default per-user location
$InstallDir = Join-Path $env:LOCALAPPDATA "Programs\$AppName"
$ExePath = Join-Path $InstallDir "$AppName.exe"

if (-not (Test-Path $ExePath)) {
Write-Error "Installation could not be verified — $ExePath not found."
Write-Host "Try running the installer manually: $InstallerPath"
exit 1
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early exit 1 paths (non-zero installer exit code / failed verification) now skip the cleanup step, leaving %TEMP%\vibegrid-install behind. If the intent is to always remove temp files after an attempted install, consider ensuring cleanup runs via try { ... } finally { ... } (or explicitly cleaning up before exiting).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9f96bbb — post-download steps are now wrapped in try/finally so temp dir is always cleaned up.

- Use split/filter/contains for PATH check instead of substring match
- Wrap post-download steps in try/finally so temp dir is always cleaned up
- Remove redundant shortcutName (defaults to productName)
@jcanizalez jcanizalez merged commit c4054ea into main Mar 23, 2026
1 check passed
@jcanizalez jcanizalez deleted the fix/windows-installer-75 branch March 23, 2026 21:49
This was referenced Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows install

2 participants