Skip to content

Fix Windows shortcut detection for redirected shell folders#449

Merged
shannah merged 1 commit intomasterfrom
claude/fix-windows-uninstall-shortcut-7JeaV
Mar 26, 2026
Merged

Fix Windows shortcut detection for redirected shell folders#449
shannah merged 1 commit intomasterfrom
claude/fix-windows-uninstall-shortcut-7JeaV

Conversation

@shannah
Copy link
Copy Markdown
Owner

@shannah shannah commented Mar 26, 2026

Summary

This PR improves Windows shortcut detection and removal by using the Windows Shell API to resolve actual folder paths, which correctly handles redirected folders (e.g., OneDrive Desktop). Previously, the code relied on hardcoded paths that could fail when Windows folders were redirected to cloud storage or other locations.

Key Changes

  • Added Shell API integration: Introduced resolveShellFolderPath() method that uses IzPack's ShellLink API to resolve actual Windows Shell folder paths for Desktop, Start Menu, and Programs Menu
  • Refactored path resolution: Replaced single-path methods (getStartMenuPath(), getDesktopLink(), etc.) with multi-path methods that return Set<File> containing both API-resolved and hardcoded fallback paths
  • Improved shortcut removal: Updated removeDesktopAlias(), removeStartMenuLink(), and removeProgramsMenuLink() to search for shortcuts in all possible locations
  • Enhanced installation: Modified installWindowsLink() to use the Shell API-resolved path when saving shortcuts, with fallback to hardcoded paths if resolution fails
  • Added imports: Added ShellLink, LinkedHashSet, and Set imports to support the new functionality

Implementation Details

  • The resolveShellFolderPath() method gracefully handles failures by catching exceptions and returning null, allowing the code to fall back to hardcoded paths
  • Uses LinkedHashSet to maintain insertion order while avoiding duplicates when both API-resolved and hardcoded paths are the same
  • All shortcut removal operations now iterate through multiple possible paths, ensuring shortcuts are found and deleted regardless of folder redirection
  • Maintains backward compatibility by keeping hardcoded paths as fallbacks

https://claude.ai/code/session_01JbZdEobUPQcnNkQ3idkYp4

…uring uninstall

The uninstaller hardcoded Desktop/Start Menu paths as %USERPROFILE%\Desktop,
but the installer creates shortcuts using the Windows Shell API which resolves
the actual folder location. On systems with OneDrive Desktop backup, these paths
differ, causing the uninstaller to miss the shortcuts. Now uses ShellLink to
resolve the real paths and checks both resolved and hardcoded locations.

https://claude.ai/code/session_01JbZdEobUPQcnNkQ3idkYp4
@shannah shannah merged commit fb1631d into master Mar 26, 2026
17 checks passed
@shannah shannah deleted the claude/fix-windows-uninstall-shortcut-7JeaV branch March 26, 2026 01:32
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.

2 participants