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

OpenInWSL doesn't work for files on network drives. #6

Open
HawkinsT opened this issue Sep 13, 2021 · 7 comments
Open

OpenInWSL doesn't work for files on network drives. #6

HawkinsT opened this issue Sep 13, 2021 · 7 comments

Comments

@HawkinsT
Copy link

As per the title, I've been unable to launch files in windows explorer with OpenInWSL if they're on a network driver. The popup at the top of the screen that OpenInWSL usually displays to indicate how the file is being opened fails to appear also. Creating a local copy of such a file, OpenInWSL will then work as expected.

@Pololot64
Copy link
Member

Can you upload the logs? ( remove any personal info first but it would be good to know the details about the path)

@Pololot64
Copy link
Member

Also is it the store of github version of openinwsl?

@HawkinsT
Copy link
Author

I'm using the store version; I can try the github version in a bit. The network location was of the format \\192.168.1.1\homes\blah\blah\somefile.py. Here's the log file (sorry for not including it previously):

2021-09-14 09:48:34,446 - OpenInWSL 1.5 store - ERROR - Cannot Open extension error
Traceback (most recent call last):
  File "main.py", line 1972, in <module>
  File "main.py", line 517, in path_converter
IndexError: string index out of range

@Pololot64
Copy link
Member

I look into this too. Again I am super busy but I won't forget.

@HawkinsT
Copy link
Author

HawkinsT commented Sep 14, 2021

Thanks. Looking into it, it seems that OpenInWSL may have to mount a network drive in the wsl instance in order to get this to work, but I don't know if this would be desirable default behaviour for everyone or not.

Looking into this did highlight an issue with OpenInWSL's more general file handling though. It makes a few assumptions that aren't always correct, meaning trying to launch a file from within a linux file system via windows (viz. via \\wsl$) won't work.

The issue's with the path_converter function in main.py. It can be fixed simply in pure python, but since wsl comes with the wslpath utility specifically for this reason perhaps using this would be the best approach as I'd expect it to handle more edge cases:

import subprocess

def path_converter(path):
    subprocess = subprocess.Popen(f"wsl wslpath -a \'{path}\'", shell=True, stdout=subprocess.PIPE)
    nix_path = subprocess.stdout.read().strip().decode('UTF-8')
    return nix_path

I'd submit a PR but am unable to properly test this in windows at present.

@Pololot64
Copy link
Member

Thanks for digging again :) Yep. I should rewrite this. Unfortunately the earliest I can release changes is in December.

@HawkinsT
Copy link
Author

No problem. Thanks for all your hard work on this and GWSL. :)

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

No branches or pull requests

2 participants