Skip to content

WSL path conversion produces invalid /mnt/wsl.localhost/ path instead of native WSL path #9

@MayoLars

Description

@MayoLars

When using "Claude Code (WSL)" with a solution opened from a WSL path, the extension
produces an invalid cd command:

bash: cd: /mnt/wsl.localhost/Ubuntu/home/mayolars/App: No such file or directory

The extension is converting the Windows UNC path \\wsl.localhost\Ubuntu\home\mayolars\App
to /mnt/wsl.localhost/Ubuntu/home/mayolars/App, which doesn't exist inside WSL.

Expected: The path should be converted to the native WSL path /home/mayolars/App
(strip \\wsl.localhost\Ubuntu and keep the rest).

Environment:

  • Windows 11, WSL2 (Ubuntu)
  • Visual Studio 2026
  • Extension mode: Claude Code (WSL)
  • Solution located at \\wsl.localhost\Ubuntu\home\mayolars\App

Suggested fix:
The conversion should detect the \\wsl.localhost\<distro>\ prefix and strip it,
since that prefix is how Windows addresses WSL paths — inside WSL, the root is /.

For example, in the path conversion logic:

  • Input: \\wsl.localhost\Ubuntu\home\mayolars\App
  • Strip: \\wsl.localhost\Ubuntu
  • Result: /home/mayolars\App

Paths under \\wsl$\ should be handled the same way (older UNC format).

Paths starting with a Windows drive letter (e.g. C:\Projects\...) should still
convert to /mnt/c/Projects/... as they do now — that conversion is correct for
accessing Windows drives from within WSL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions