From 4e232b565e9a2f5af3e18dacc6bb735d2c2cd15b Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Fri, 11 Feb 2022 18:32:01 +0800 Subject: [PATCH 1/3] fix(shim): Fix shim when app path has white spaces --- lib/core.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/core.ps1 b/lib/core.ps1 index d1189c2556..c830eb53da 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -615,7 +615,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 } @@ -644,11 +644,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" ) From ba2e2f8113dfef62830ba884d79ce212aa60f2e5 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Fri, 11 Feb 2022 21:06:27 +0800 Subject: [PATCH 2/3] docs(changelog): Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ad176fd80..47a74d6616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,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 ([#4732](https://github.com/ScoopInstaller/Scoop/issues/4732)) - **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-checkup:** Skip 'check_windows_defender' when have not admin privileges ([#4699](https://github.com/ScoopInstaller/Scoop/issues/4699)) From 88179c7765972f493fe1e6c98e82c42608f6abd2 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Fri, 11 Feb 2022 21:08:06 +0800 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a74d6616..5cd11a1392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,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 ([#4732](https://github.com/ScoopInstaller/Scoop/issues/4732)) +- **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-checkup:** Skip 'check_windows_defender' when have not admin privileges ([#4699](https://github.com/ScoopInstaller/Scoop/issues/4699))