Skip to content

Commit

Permalink
Improved correctness of target binding at shimming point.
Browse files Browse the repository at this point in the history
  • Loading branch information
excitoon committed Mar 10, 2018
1 parent 56a7af4 commit b9850fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ powershell -noprofile -ex unrestricted `"& '$resolved_path' %args%;exit `$lastex
function search_in_path($target) {
$path = (env 'PATH' $false) + ";" + (env 'PATH' $true)
$path.split(';') | % {
if(test-path "$_\$target") {
if(test-path "$_\$target" -pathType leaf) {
return "$_\$target"
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -679,14 +679,14 @@ function create_shims($manifest, $dir, $global, $arch) {
$target, $name, $arg = shim_def $_
write-output "Creating shim for '$name'."

if(test-path "$dir\$target") {
if(test-path "$dir\$target" -pathType leaf) {
$bin = "$dir\$target"
} elseif(test-path $target) {
} elseif(test-path $target -pathType leaf) {
$bin = $target
} else {
$bin = search_in_path $target
}
if(!(test-path $bin)) { abort "Can't shim '$target': File doesn't exist."}
if(!$bin) { abort "Can't shim '$target': File doesn't exist."}

shim $bin $global $name (substitute $arg @{ '$dir' = $dir; '$original_dir' = $original_dir; '$persist_dir' = $persist_dir})
}
Expand Down

0 comments on commit b9850fa

Please sign in to comment.