Skip to content

Fix TranslateWindowsPath when USERPROFILE is a disk root#1476

Open
LeviPesin wants to merge 5 commits into
microsoft:mainfrom
LeviPesin:patch-1
Open

Fix TranslateWindowsPath when USERPROFILE is a disk root#1476
LeviPesin wants to merge 5 commits into
microsoft:mainfrom
LeviPesin:patch-1

Conversation

@LeviPesin

@LeviPesin LeviPesin commented Jun 25, 2026

Copy link
Copy Markdown

Closes #1475

My attempt at fixing it, untested now tested.

Works by adding a slash to the Windows path being converted to WSL's one (i.e. D: gets converted to D:/, and even if there already is a slash in the end (would break in any case later) it still works fine) and removing it after the conversion.

Copilot has also requested me to add a check that result is not empty.

Copilot AI review requested due to automatic review settings June 25, 2026 22:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to fix TranslateWindowsPath so Windows drive-root paths like D: are translated correctly to WSL paths (avoiding Weston/app failures when USERPROFILE points to a drive root), per issue #1475.

Changes:

  • Modifies how the wslpath command line is constructed for TranslateWindowsPath.
  • Extends output trimming to remove trailing / in addition to \n.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread WSLGd/main.cpp Outdated
Comment thread WSLGd/main.cpp

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread WSLGd/main.cpp
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 25, 2026 22:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread WSLGd/main.cpp
Copilot AI review requested due to automatic review settings June 25, 2026 22:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread WSLGd/main.cpp
@LeviPesin

Copy link
Copy Markdown
Author

Tested and it works perfectly for me!

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.

TranslateWindowsPath is broken when USERPROFILE is a disk root

2 participants