WSL support
Closed this issue · 7 comments
To support WSL, you just check for WSL, and run the same command as in the Sys.iswindows()
case.
The question is what to do with paths: one option is to assume that the provided path is a linux path, and then use
path_translated_to_windows = read(`wslpath -w $(abs_path)`, String)
to get the Windows path.
Note: you can use this snippet to resolve ~
and ..
to absolute paths.
Another option is to detect whether the path is a linux path, windows path, or something else (e.g. URL), and convert approriately.
A third option is to let the function caller decide, but that is less cross-platformy.
What happens with the current master
on WSL?
Thanks. I will think about this.
Since I have not used Windows for decades, I am unfamiliar with WSL, so I am not sure what users want in this case.
WSL users, please chime in here.
I thought about it again, and I'd like to correct myself:
If you are using Julia inside WSL, then the Linux filesystem is the only filesystem that you use. This is how WSL works - programs run in actual linux, including the file system. You even access Windows files as /mnt/c/Users/fonsi/Documents/...
, i.e. via Linuxified "proxy".
So I believe that you will always call DefaultApplication.open(linux_path)
(or DefaultApplication.open(url)
), and never DefaultApplication.open(windows_path)
. (But please correct me if I missed something.) This is reflected in the rest of Julia: inside WSL, tempdir()
gives /tmp
, joindir("a","b")
gives a/b
, not a\\b
, homedir()
gives /home/fonsi/
, not the Windows path, etc. If Julia is running on WSL, you can assume that a path::String
is a linux path.
So the question is: if you are running WSL and you call DefaultApplication.open(path)
, should it open the Windows default app with that file (transformed to a Windows path), or a Linux app?
My take on this is: you use DefaultApplication.jl
to open GUI applications. WSL can technically run an X server, but this is not the default, and I believe that it is used very very rarely, and only for a couple of specialized apps.
I sympathetic to this solution, and will revisit this again when JuliaLang/julia#36425 is merged and/or JuliaLang/julia#36354 is resolved some other way.