Skip to content

Commit

Permalink
Merge pull request #201 from IsaacOscar/wslpath-fix
Browse files Browse the repository at this point in the history
make wslview always use wslpath
  • Loading branch information
patrick330602 authored Oct 4, 2021
2 parents 9a4e7b7 + fabf1b9 commit 3e57b00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
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

0 comments on commit 3e57b00

Please sign in to comment.