fix(windows): path handling fixes for Windows#6763
fix(windows): path handling fixes for Windows#6763pschiel wants to merge 2 commits intoanomalyco:devfrom
Conversation
032638f to
61531f5
Compare
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
adf2edd to
9b205c2
Compare
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
9b205c2 to
bef6a68
Compare
|
This sounds perfect @pschiel If you can get it ready and finish the cleanup you said I can test and approve. Btw don't put it behind an experimental flag. We'll ship once it's working. |
767f78b to
ba251fb
Compare
ba251fb to
aaa0f60
Compare
| @@ -1 +1 @@ | |||
| ../../ui/src/custom-elements.d.ts | |||
There was a problem hiding this comment.
fyi this is a symlink.
on windows its disabled by default
enable it with
git config core.symlinks true
then recheckout all the files with
git checkout -- .
obviously that would reset any changes so stash/commit first.
that will fix the typecheck too
There was a problem hiding this comment.
was intentional, as this requires admin permissions on windows.
thoughts: changing symlink into export statement in 2 files is worth it for that (the other ~70 symlinks are fonts/images and not affected by TS parsing)
There was a problem hiding this comment.
Something like this would've worked keeping as a simlink
/// <reference path="../../ui/src/custom-elements.d.ts" />
There was a problem hiding this comment.
@neriousy I went by this https://typescript-eslint.io/rules/triple-slash-reference/ which mentions triple slash being discouraged in modern ES6, and a rule for it.
please feel free to change, it was just so typecheck and tests run without errors, in a win32 environment
62152d4 to
30a54ce
Compare
|
I'll check this out in the next week or so - sorry just fairly busy.
I think there's a test failing? |
|
BTW the main things I'll be looking at (if you want to beat me to it)
also just confirming your section 'Observed issues' this PR fixes all those items? |
Ah yep - leave it with me :) |
|
Can't reproduce that unicode fail. Ran tests on git bash, powershell and in a Debian container, all passed 🤔 |
|
Yup definitely get the whole need for bash compatible paths at all times, give me a sec to investigate impl details and options |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
0593e41 to
2e18013
Compare
|
added fixes to avoid bun hard crashing (segfaulting) when invalid cwd is passed |
80c5f6f to
d997822
Compare
|
issues with added prompt test: |
d997822 to
f0285ea
Compare
f0285ea to
20bd3e9
Compare


fixes #10360
fixes #10872
fixes #11042
fixes #11043
fixes #11044
fixes #11045
fixes #10871
fixes #8924
fixes #8567
fixes #7279
fixes #6020
fixes ALL test cases in the test suite running on win32 system
(most likely plus a series of more issues)
partly fixes #9077
possibly fixes #10798
possibly fixes #10716
possibly fixes #10642
Summary
This fix solves a whole series of bugs, resulting from filepath issues with backslashes occuring on Windows.
→ Solution: normalize all internal paths to forward slashes using centralized
FilesystemwrappersWhy this works: all win32 shells work with forward slash paths, this is de-facto industry standard (git, vscode, cmake, ... all use this pattern)
Observed issues
❌
git rev-parse --show-toplevelreturnsE:/x/yforward slash format → worktree/directory mismatch❌
path.resolve(),path.relative(),realpathSync.native(),realpath(bash) break with git bash paths (various issues)❌
/d/xwithin C drive (/c/) results in things likeC:\d\x❌ relative paths not working like expected using cross-drive
❌
containslogic not working → issues with permission system and external_directory❌
/tmpinside git bash is something else outside of it❌ tools break using backslash paths (some backslashes get "eaten")
❌ escaping hell for agents → requires double/quadruple escaping
❌ observed in all win32 native shells (git bash, cmd, powershell/pwsh)
❌ few issues in app/desktop (wrong filepath splits/usage)
❌ bun hard crashing with segfault when
spawn()is used with non-existing directoryTested with fix
✅ local test suite succeeds now with 100% (
bun testinpackages/opencode)✅ all possible path variants (
C:\a\b,C:/a/b,/c/a/b,/cygdrive/c/a/b) are normalized intoC:/a/bformat✅ full functionality of all tools (
ENOENTerrors gone, permissions, relative paths, external directory, LSP)✅ worktree/sandbox handling correct
✅ tested TUI and desktop
✅ bun spawns via bash/pty not segfaulting
How to reproduce/test
Notes
A few more places would require normalization - but they're unused/dead code (should be removed):
packages/ui/src/context/sync.tsxline 16absolute()packages/ui/src/context/local.tsxline 392, 420, 455, 546 - file tree operations (no file tree used)