Skip to content

Fix duplicate path resolution in PathExpander by using HashSet as intended#50

Merged
Belim merged 1 commit into
builtbybel:mainfrom
Maloron:fix/path-expander-deduplication
May 30, 2026
Merged

Fix duplicate path resolution in PathExpander by using HashSet as intended#50
Belim merged 1 commit into
builtbybel:mainfrom
Maloron:fix/path-expander-deduplication

Conversation

@Maloron
Copy link
Copy Markdown
Contributor

@Maloron Maloron commented May 29, 2026

This PR aligns the code with the developer's original intent expressed in comments to use a HashSet for resolving paths and preventing duplicate results (e.g., when %ProgramFiles% and %ProgramFiles(x86)% point to the same directory).

The previous implementation used a List<string> and performed the check if (!results.Contains(expanded)), comparing the unresolved path template (with wildcards) to the list of resolved actual paths. This logic bug caused the check to always fail and add duplicates.

Changes:

  • Changed results from List<string> to HashSet<string> internally.
  • Removed the incorrect check !results.Contains(expanded).
  • Converted the final set back to List<string> via .ToList() before returning.

@Belim Belim merged commit f5a3c46 into builtbybel:main May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants