diff --git a/CHANGELOG.md b/CHANGELOG.md index d6b7669e9a..833b88e919 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - **shim:** Fix PS1 shim error when in different drive in PS7 ([#4614](https://github.com/ScoopInstaller/Scoop/issues/4614)) - **shim:** Fix `sh` shim error in WSL ([#4637](https://github.com/ScoopInstaller/Scoop/issues/4637)) - **shim:** Use `-file` instead of `-command` in ps1 script shims ([#4721](https://github.com/ScoopInstaller/Scoop/issues/4721)) +- **shim:** Fix exe shim when app path has white spaces ([#4734](https://github.com/ScoopInstaller/Scoop/issues/4734)) - **versions:** Fix wrong version number when only one version dir ([#4679](https://github.com/ScoopInstaller/Scoop/issues/4679)) - **versions:** Get current version from failed installation if possible ([#4720](https://github.com/ScoopInstaller/Scoop/issues/4720), [#4725](https://github.com/ScoopInstaller/Scoop/issues/4725)) - **scoop-alias:** Fix alias initialization ([#4737](https://github.com/ScoopInstaller/Scoop/issues/4737)) diff --git a/lib/core.ps1 b/lib/core.ps1 index 254e8840be..b7fda64879 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -621,7 +621,7 @@ function shim($path, $global, $name, $arg) { # for programs with no awareness of any shell warn_on_overwrite "$shim.shim" $path Copy-Item (get_shim_path) "$shim.exe" -Force - Write-Output "path = $resolved_path" | Out-File "$shim.shim" -Encoding ASCII + Write-Output "path = `"$resolved_path`"" | Out-File "$shim.shim" -Encoding ASCII if ($arg) { Write-Output "args = $arg" | Out-File "$shim.shim" -Encoding ASCII -Append } @@ -650,11 +650,9 @@ function shim($path, $global, $name, $arg) { "exit `$LASTEXITCODE" ) } else { - # Setting PSScriptRoot in Shim if it is not defined, so the shim doesn't break in PowerShell 2.0 @( "# $resolved_path", - "if (!(Test-Path Variable:PSScriptRoot)) { `$PSScriptRoot = Split-Path `$MyInvocation.MyCommand.Path -Parent }", - "`$path = Join-Path `"`$PSScriptRoot`" `"$relative_path`"", + "`$path = Join-Path `$PSScriptRoot `"$relative_path`"", "if (`$MyInvocation.ExpectingInput) { `$input | & `$path $arg @args } else { & `$path $arg @args }", "exit `$LASTEXITCODE" )