diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c56177d27..eefe078174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Bug Fixes - **config:** Change config option to snake_case in file and SCREAMING_CASE in code ([#5116](https://github.com/ScoopInstaller/Scoop/issues/5116)) +- **psmodule:** Remove folder recursively when unlinking previous module path ([#5127](https://github.com/ScoopInstaller/Scoop/issues/5127)) ### Code Refactoring diff --git a/lib/psmodules.ps1 b/lib/psmodules.ps1 index 45525d5173..2fbb6e6525 100644 --- a/lib/psmodules.ps1 +++ b/lib/psmodules.ps1 @@ -23,7 +23,7 @@ function install_psmodule($manifest, $dir, $global) { if (Test-Path $linkfrom) { warn "$(friendly_path $linkfrom) already exists. It will be replaced." - Remove-Item -Path $linkfrom -Force -ErrorAction SilentlyContinue + Remove-Item -Path $linkfrom -Force -Recurse -ErrorAction SilentlyContinue } New-DirectoryJunction $linkfrom $dir | Out-Null @@ -40,7 +40,7 @@ function uninstall_psmodule($manifest, $dir, $global) { if (Test-Path $linkfrom) { Write-Host "Removing $(friendly_path $linkfrom)" $linkfrom = Convert-Path $linkfrom - Remove-Item -Path $linkfrom -Force -ErrorAction SilentlyContinue + Remove-Item -Path $linkfrom -Force -Recurse -ErrorAction SilentlyContinue } }