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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ You can install `wslu` with the following command:

```
sudo apt install gnupg2 apt-transport-https
wget -O - https://access.patrickwu.space/wslu/public.asc | sudo apt-key add -
echo "deb https://access.patrickwu.space/wslu/debian buster main" | sudo tee -a /etc/apt/sources.list
wget -O - https://pkg.wslutiliti.es/public.key | sudo tee -a /etc/apt/trusted.gpg.d/wslu.asc
echo "deb https://pkg.wslutiliti.es/debian buster main" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install wslu
```
Expand All @@ -99,7 +99,7 @@ sudo dnf copr enable wslutilities/wslu
sudo dnf install wslu
```

### Fedora Remix
### Fedora Remix for WSL

Preinstalled.

Expand All @@ -109,8 +109,8 @@ You can install `wslu` with the following command:

```
sudo apt install gnupg2 apt-transport-https
wget -O - https://access.patrickwu.space/wslu/public.asc | sudo apt-key add -
echo "deb https://access.patrickwu.space/wslu/kali kali-rolling main" | sudo tee -a /etc/apt/sources.list
wget -O - https://pkg.wslutiliti.es/public.key | sudo tee -a /etc/apt/trusted.gpg.d/wslu.asc
echo "deb https://pkg.wslutiliti.es/kali kali-rolling main" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install wslu
```
Expand All @@ -119,7 +119,7 @@ sudo apt install wslu

Preinstalled.

### Pengwin Enterprise
### Pengwin Enterprise 7

You can install `wslu` with the following command:

Expand Down
14 changes: 1 addition & 13 deletions src/wslview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,16 @@ if [[ "$lname" != "" ]]; then
if [[ "$lname" =~ ^file:\/\/.*$ ]] && [[ ! "$lname" =~ ^file:\/\/(\/)+[A-Za-z]\:.*$ ]]; then
[ $wslutmpbuild -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34
properfile_full_path="$(readlink -f "${lname//file:\/\//}")"
interop_win_type="$(interop_prefix)$(sysdrive_prefix)"
converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}"
[[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")"
lname="$converted_file_path"
# Linux absolute path
elif [[ "$lname" =~ ^(/[^/]+)*(/)?$ ]]; then
[ $wslutmpbuild -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34
properfile_full_path="$(readlink -f "${lname}")"
interop_win_type="$(interop_prefix)$(sysdrive_prefix)"
converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}"
[[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")"
lname="$converted_file_path"
# Linux relative path
elif [[ -d "$(readlink -f "$lname")" ]] || [[ -f "$(readlink -f "$lname")" ]]; then
[ $wslutmpbuild -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34
properfile_full_path="$(readlink -f "${lname}")"
interop_win_type="$(interop_prefix)$(sysdrive_prefix)"
converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}"
[[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")"
lname="$converted_file_path"
fi
winps_exec Start "\"$lname\""
winps_exec Start "\"$(wslpath -w "$properfile_full_path" 2>/dev/null || echo "$lname")\""
else
error_echo "No input, aborting" 21
fi