fix(path): support Windows MSYS drive paths - #566
Open
wang-kaopu wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
修复 Windows + Git Bash / MSYS 会话下,侧边栏无法正确打开
/e/...、/c/...等盘符映射路径的问题,对应 #556。Git Bash / MSYS 会将 Windows 盘符表示为 POSIX 风格路径,例如:
/e/project/foo.py→E:\project\foo.py/c/Users/me/file.md→C:\Users\me\file.md此前
resolveSessionPath()在 Windows 下仅处理 WSL UNC 会话。对于普通 Windows cwd,/e/...会原样传入后续 Win32 路径解析,最终被解释为当前盘符下的C:\e\...,导致realpath报ENOENT。本 PR 在现有 WSL 路径投影之后增加 MSYS 单字母盘符映射:
/x/...映射为X:\.../e/...仍解释为 distro 内的 Linux 路径/tmp/...、/ab/...等非单字母盘符形式保持原有行为/e保持原有行为测试
已补充
resolveSessionPath()单元测试,覆盖:/e/...MSYS 盘符映射/c/...MSYS 盘符映射/E//tmp/...不被误判/ab/...不被误判/e不被误判本地验证通过:
pnpm testpnpm typecheckpnpm lintFixes #556