Skip to content

Commit

Permalink
Make SCOOP_PATH as default PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven committed Apr 12, 2024
1 parent 412c903 commit b81735f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 40 deletions.
37 changes: 1 addition & 36 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,42 +161,7 @@ function Complete-ConfigChange {
[string]
$Value
)

if ($Name -eq 'use_isolated_path') {
. "$PSScriptRoot\..\lib\system.ps1"

if ($Value -eq $true) {
info 'Switching to isolated path... This may take a while, please wait.'
$movedPath = Remove-Path -Path "$scoopdir\apps\*" -Quiet -PassThru
if ($movedPath) {
Add-Path -Path $movedPath -TargetEnvVar 'SCOOP_PATH' -Quiet
Add-Path -Path '%SCOOP_PATH%' -Quiet
}
if (is_admin) {
$movedPath = Remove-Path -Path "$globaldir\apps\*" -Global -Quiet -PassThru
if ($movedPath) {
Add-Path -Path $movedPath -TargetEnvVar 'SCOOP_PATH' -Global -Quiet
Add-Path -Path '%SCOOP_PATH%' -Global -Quiet
}
}
} else {
info 'Switching to shared path... This may take a while, please wait.'
$movedPath = Get-EnvVar -Name 'SCOOP_PATH'
if ($movedPath) {
Add-Path -Path $movedPath -Quiet
Remove-Path -Path '%SCOOP_PATH%' -Quiet
Set-EnvVar -Name 'SCOOP_PATH' -Quiet
}
if (is_admin) {
$movedPath = Get-EnvVar -Name 'SCOOP_PATH' -Global
if ($movedPath) {
Add-Path -Path $movedPath -Global -Quiet
Remove-Path -Path '%SCOOP_PATH%' -Global -Quiet
Set-EnvVar -Name 'SCOOP_PATH' -Global -Quiet
}
}
}
}
# Add needed config change logic here
}

function setup_proxy() {
Expand Down
4 changes: 0 additions & 4 deletions libexec/scoop-config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@
# Nightly version is formatted as 'nightly-yyyyMMdd' and will be updated after one day if this is set to $true.
# Otherwise, nightly version will not be updated unless `--force` is used.
#
# use_isolated_path: $true|$false
# When set to $true, Scoop will use `SCOOP_PATH` environment variable to store apps' `PATH`s.
# This is useful when you want to isolate Scoop from the system `PATH`.
#
# ARIA2 configuration
# -------------------
#
Expand Down
16 changes: 16 additions & 0 deletions libexec/scoop-update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ if(($PSVersionTable.PSVersion.Major) -lt 5) {
}
$show_update_log = get_config SHOW_UPDATE_LOG $true

# Migrate PATH EnvVar to SCOOP_PATH
$movedPath = Remove-Path -Path "$scoopdir\apps\*" -Quiet -PassThru
if ($movedPath) {
info 'Switching to isolated path... This may take a while, please wait.'
Add-Path -Path $movedPath -TargetEnvVar 'SCOOP_PATH' -Quiet
Add-Path -Path '%SCOOP_PATH%' -Quiet
}
if (is_admin) {
$movedPath = Remove-Path -Path "$globaldir\apps\*" -Global -Quiet -PassThru
if ($movedPath) {
info 'Switching to isolated global path... This may take a while, please wait.'
Add-Path -Path $movedPath -TargetEnvVar 'SCOOP_PATH' -Global -Quiet
Add-Path -Path '%SCOOP_PATH%' -Global -Quiet
}
}

function Sync-Scoop {
[CmdletBinding()]
Param (
Expand Down

0 comments on commit b81735f

Please sign in to comment.