Skip to content

fix realpath implementation on Windows#426

Merged
Guest0x0 merged 1 commit into
mainfrom
fix-windows-realpath
Jun 11, 2026
Merged

fix realpath implementation on Windows#426
Guest0x0 merged 1 commit into
mainfrom
fix-windows-realpath

Conversation

@Guest0x0

Copy link
Copy Markdown
Collaborator

closes #404

Previously @fs.realpath uses GetFullPathNameW on Windows, which does not deference symlink/reparse point. This PR fixes the implementation and use GetFinalPathNameByHandleW instead. This PR also eliminates the allocation of MoonBit object inside the realpath thread pool job, making the code easier to port to WASM backend. This is not solely for WASM compatibility, though: GetFinalPathNameByHandleW return path with extended length prefix \\?\, which need to be trimmed, so one extra layer of copy is unavoidable.

@Guest0x0 Guest0x0 force-pushed the fix-windows-realpath branch from 2ab6e4b to 814f4ec Compare June 11, 2026 08:29
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 500

Coverage increased (+0.004%) to 77.552%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4673
Covered Lines: 3624
Line Coverage: 77.55%
Coverage Strength: 72201.96 hits per line

💛 - Coveralls

@Guest0x0 Guest0x0 merged commit 83b87d3 into main Jun 11, 2026
17 checks passed
@Guest0x0 Guest0x0 deleted the fix-windows-realpath branch June 11, 2026 08:44
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