fix(uninstall): sweep legacy distro-suffixed Studio shortcuts

The Windows uninstaller removed only the exact name "Unsloth Studio.lnk",
orphaning legacy "Unsloth Studio (WSL - <distro>).lnk" shortcuts left by
pre-release dev builds. Glob "Unsloth Studio (*.lnk" across Desktop + Start
Menu so the documented "remove the shortcuts" contract holds regardless of
suffix. Validated on N1X: both canonical and suffixed .lnk removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Han 2026-06-11 23:15:22 -07:00
commit aa01e8b382

View file

@ -341,13 +341,17 @@ function Uninstall-UnslothStudio {
}
# ── Remove desktop and Start Menu shortcuts ──
# Canonical name is "Unsloth Studio.lnk"; also sweep legacy distro-suffixed
# names ("Unsloth Studio (WSL - <distro>).lnk") left by pre-release dev builds.
_Step "Removing desktop and Start Menu shortcuts..."
try {
$desktop = [Environment]::GetFolderPath("Desktop")
if ($desktop) { _RemovePath (Join-Path $desktop "Unsloth Studio.lnk") }
} catch { }
if ($env:APPDATA) {
_RemovePath (Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Unsloth Studio.lnk")
$shortcutDirs = @()
try { $d = [Environment]::GetFolderPath("Desktop"); if ($d) { $shortcutDirs += $d } } catch { }
if ($env:APPDATA) { $shortcutDirs += (Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs") }
foreach ($dir in $shortcutDirs) {
if (-not (Test-Path -LiteralPath $dir)) { continue }
_RemovePath (Join-Path $dir "Unsloth Studio.lnk")
Get-ChildItem -LiteralPath $dir -Filter "Unsloth Studio (*.lnk" -ErrorAction SilentlyContinue |
ForEach-Object { _RemovePath $_.FullName }
}
# Invalidate the Win11 Start Menu tile cache so the removed shortcut's tile
# disappears promptly instead of lingering stale (mirrors install.ps1's