Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- **core:** Do not call `scoop` externally from inside the code ([#5695](https://github.com/ScoopInstaller/Scoop/issues/5695))
- **scoop-checkup:** Don't throw 7zip error when external 7zip is used ([#5703](https://github.com/ScoopInstaller/Scoop/issues/5703))
- **config:** Warn users about misconfigured GitHub token ([#5777](https://github.com/ScoopInstaller/Scoop/issues/5777))
- **update/uninstall:** Remove items from PATH correctly ([#5833](https://github.com/ScoopInstaller/Scoop/issues/5833))

### Performance Improvements

Expand Down
15 changes: 10 additions & 5 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,6 @@ function env_add_path($manifest, $dir, $global, $arch) {
} else {
$path_dir = Join-Path $dir $_
}

if (!(is_in_dir $dir $path_dir)) {
abort "Error in manifest: env_add_path '$_' is outside the app directory."
}
Expand All @@ -928,10 +927,16 @@ function env_add_path($manifest, $dir, $global, $arch) {

function env_rm_path($manifest, $dir, $global, $arch) {
$env_add_path = arch_specific 'env_add_path' $manifest $arch
$env_add_path | Where-Object { $_ } | ForEach-Object {
$path_dir = Join-Path $dir $_

remove_from_path $path_dir $global
$dir = $dir.TrimEnd('\')
if ($env_add_path) {
$env_add_path | Where-Object { $_ } | ForEach-Object {
if ($_ -eq '.') {
$path_dir = $dir
} else {
$path_dir = Join-Path $dir $_
}
remove_from_path $path_dir $global
}
}
}

Expand Down
5 changes: 2 additions & 3 deletions libexec/scoop-update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,14 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
Write-Host "Uninstalling '$app' ($old_version)"
run_uninstaller $old_manifest $architecture $dir
rm_shims $app $old_manifest $global $architecture
env_rm_path $old_manifest $dir $global $architecture
env_rm $old_manifest $global $architecture

# If a junction was used during install, that will have been used
# as the reference directory. Otherwise it will just be the version
# directory.
$refdir = unlink_current $dir

uninstall_psmodule $old_manifest $refdir $global
env_rm_path $old_manifest $refdir $global $architecture
env_rm $old_manifest $global $architecture

if ($force -and ($old_version -eq $version)) {
if (!(Test-Path "$dir/../_$version.old")) {
Expand Down