Skip to content

Commit 5d5c7fa

Browse files
committed
fix(core): Filter null or empty string from Scoops directory settings
1 parent 16f88ee commit 5d5c7fa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/core.ps1

+7-3
Original file line numberDiff line numberDiff line change
@@ -838,14 +838,18 @@ function get_magic_bytes_pretty($file, $glue = ' ') {
838838
# for all communication with api.github.com
839839
Optimize-SecurityProtocol
840840

841-
$scoopdir = $env:SCOOP, (get_config 'rootPath'), "$env:USERPROFILE\scoop" | Select-Object -first 1
842-
$globaldir = $env:SCOOP_GLOBAL, (get_config 'globalPath'), "$env:ProgramData\scoop" | Select-Object -first 1
841+
# Scoop root directory
842+
$scoopdir = $env:SCOOP, (get_config 'rootPath'), "$env:USERPROFILE\scoop" | Where-Object { -not [String]::IsNullOrEmpty($_) } | Select-Object -First 1
843843

844+
# Scoop global apps directory
845+
$globaldir = $env:SCOOP_GLOBAL, (get_config 'globalPath'), "$env:ProgramData\scoop" | Where-Object { -not [String]::IsNullOrEmpty($_) } | Select-Object -first 1
846+
847+
# Scoop cache directory
844848
# Note: Setting the SCOOP_CACHE environment variable to use a shared directory
845849
# is experimental and untested. There may be concurrency issues when
846850
# multiple users write and access cached files at the same time.
847851
# Use at your own risk.
848-
$cachedir = $env:SCOOP_CACHE, (get_config 'cachePath'), "$scoopdir\cache" | Select-Object -first 1
852+
$cachedir = $env:SCOOP_CACHE, (get_config 'cachePath'), "$scoopdir\cache" | Where-Object { -not [String]::IsNullOrEmpty($_) } | Select-Object -first 1
849853

850854
# Scoop config file migration
851855
$configHome = $env:XDG_CONFIG_HOME, "$env:USERPROFILE\.config" | Select-Object -First 1

0 commit comments

Comments
 (0)