Skip to content

Commit

Permalink
wslusc: fix a problem in command generation
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick330602 committed Jun 28, 2020
1 parent 20b9de8 commit 795440d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/wslusc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ if [[ "$cname_header" != "" ]]; then
fi

# always absolute path
cname_header=$(readlink -f "$cname_header")
tmp_cname_header="$(readlink -f "$cname_header")"
if [ ! -f "$cname_header" ]; then
cname_header="$(which "$cname_header")"
else
cname_header="$tmp_cname_header"
fi

# handling no name given case
new_cname=$(basename "$cname_header")
Expand Down Expand Up @@ -118,7 +123,7 @@ if [[ "$cname_header" != "" ]]; then
fi

if [[ "$is_gui" == "1" ]]; then
winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs \"$distro_location_win\" $distro_param \"$customenv /usr/share/wslu/wslusc-helper.sh $cname\"';\$s.IconLocation='$iconpath';\$s.Save();"
winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs \"$distro_location_win\" $distro_param $customenv /usr/share/wslu/wslusc-helper.sh $cname';\$s.IconLocation='$iconpath';\$s.Save();"
else
winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='\"$distro_location_win\"';\$s.Arguments='$distro_param $customenv bash -l -c $cname';\$s.IconLocation='$iconpath';\$s.Save();"
fi
Expand Down

0 comments on commit 795440d

Please sign in to comment.