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

Add alt-shim support (fixes #3634) #3998

Merged
merged 7 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ function shim($path, $global, $name, $arg) {

if($path -match '\.(exe|com)$') {
# for programs with no awareness of any shell
Copy-Item "$(versiondir 'scoop' 'current')\supporting\shimexe\bin\shim.exe" "$shim.exe" -force
Copy-Item (get_shim_path) "$shim.exe" -force
write-output "path = $resolved_path" | out-file "$shim.shim" -encoding utf8
if($arg) {
write-output "args = $arg" | out-file "$shim.shim" -encoding utf8 -append
Expand Down Expand Up @@ -608,6 +608,18 @@ powershell -noprofile -ex unrestricted `"& '$resolved_path' $arg %args%;exit `$l
}
}

function get_shim_path() {
$shim_path = "$(versiondir 'scoop' 'current')\supporting\shimexe\bin\shim.exe"
$shim_version = get_config 'shim' 'default'
switch ($shim_version) {
'71' { $shim_path = "$(versiondir 'scoop' 'current')\supporting\shims\71\shim.exe" }
'kiennq' { $shim_path = "$(versiondir 'scoop' 'current')\supporting\shims\kiennq\shim.exe" }
'default' { true }
Copy link
Contributor

@kiennq kiennq Aug 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this $true instead?
Or nothing should be put here.

Suggested change
'default' { true }
'default' {}

default { warn "Unknown shim version: '$shim_version'" }
}
return $shim_path
}

function search_in_path($target) {
$path = (env 'PATH' $false) + ";" + (env 'PATH' $true)
foreach($dir in $path.split(';')) {
Expand Down
1 change: 1 addition & 0 deletions supporting/shims/71/checksum.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
70d4690b8ac3b3f715f537cdea6e07a39fda4bc0347bf6b958e4f3ff2f0e04d4 shim.exe
1 change: 1 addition & 0 deletions supporting/shims/71/checksum.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ecde07b32192846c4885cf4d2208eedc170765ea115ae49b81509fed0ce474e21064100bb2f3d815ee79f1c12463d32ef013d4182647eae71855cd18e4196176 shim.exe
Binary file added supporting/shims/71/shim.exe
Binary file not shown.
1 change: 1 addition & 0 deletions supporting/shims/kiennq/checksum.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1f0caa57aec18b828469577887a95908b1fa0570bca2979d9ff522e0ae07ea11 bin/shim.exe
1 change: 1 addition & 0 deletions supporting/shims/kiennq/checksum.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b604a30f71f92a7f3000562dd33499f4a3197b78bea6cef54d4b03d8403ba96587fa28c7165ff430bd9f72094e5bd49737f6b2a71f81660e1a83233043d85774 bin/shim.exe
Binary file added supporting/shims/kiennq/shim.exe
Binary file not shown.