Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make wslview always use wslpath #201

Merged
merged 9 commits into from
Oct 4, 2021

Conversation

IsaacOscar
Copy link
Contributor

Wslview currently dosn't work on paths you've mounted yourself, e.g:

mkdir /mnt/win
mount 'C:\Windows' /mnt/win -t drvfs # or the equivalent in /etc/fstab
wslview /mnt/win/notepad.exe

Tries to open \\wsl$\WSL\mnt\win\notepad.exe which raises an InvalidOperationException.

However, wslpath -w /mnt/win/notepad.exe reports the correct path as C:\Windows\notepad.txt, it also works for pure linux paths like wslpath -w /var/log/alternatives.log, which reports \\wsl$\WSL\var\log\alternatives.log.

So I've modified the wslview script to now just always use wslpath to get the windows path.

Copy link
Member

@patrick330602 patrick330602 left a comment

Choose a reason for hiding this comment

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

Since wslview can also use as a browser, which allows you to open local webpages and websites, this code will break that part.

@IsaacOscar
Copy link
Contributor Author

I'm not sure what you mean exactly.
My original version works with things like wslview file:///usr/webpage.html or wslview file:///c/webpage.html, but it didn't work with wslview htttp://github.com.

So I made a change that bypasses wslpath if that fails, so now wslview http://github.com will work (along with any other protocol that windows happens to understand).

@patrick330602 patrick330602 changed the base branch from master to lts/master October 4, 2021 03:18
@patrick330602
Copy link
Member

Sorry for the late reply due to the burnout from the work. After a reread of your code, it is okay to be merged. Sorry for the hassle caused.

@patrick330602 patrick330602 merged commit 3e57b00 into wslutilities:lts/master Oct 4, 2021
@patrick330602 patrick330602 added the hacktoberfest-accepted Temporary Tag label Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants