From 328db63eb28f3c70f3a7240dc845ede5fc609b29 Mon Sep 17 00:00:00 2001 From: Chawye Hsu Date: Thu, 19 Mar 2026 14:18:18 +0800 Subject: [PATCH] feat!: default config file location to scoop root directory Signed-off-by: Chawye Hsu --- .github/scripts/e2e-test.ps1 | 18 +++++++++++++++--- install.ps1 | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/scripts/e2e-test.ps1 b/.github/scripts/e2e-test.ps1 index 444fbe4..efbe209 100644 --- a/.github/scripts/e2e-test.ps1 +++ b/.github/scripts/e2e-test.ps1 @@ -6,22 +6,34 @@ if ($env:CI -ne $true -or $env:GITHUB_ACTIONS -ne $true) { throw 'This script is intended to be run in GitHub Actions CI environment only' } -Write-Output "$Env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append $WorkingRoot = "$PSScriptRoot\..\.." # Typical installation +Write-Output '# Testing typical installation' & "$WorkingRoot\install.ps1" -if (-not (Test-Path -Path "$Env:USERPROFILE\.config\scoop\config.json")) { +Write-Output "$Env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append +$configFilePath = "$Env:USERPROFILE\scoop\config.json" +if (-not (Test-Path -Path $configFilePath)) { throw 'Scoop config file should exist after installation' } scoop help +scoop config use_sqlite_cache true +Write-Output "Config file: $configFilePath" +Get-Content -Raw -Path $configFilePath | Write-Output Remove-Item -Path "$Env:USERPROFILE\scoop" -Recurse -Force -ErrorAction SilentlyContinue # Fall back to download zips when git not available git config --global protocol.https.allow never # Custom installation directory $CustomScoopDir = "$Env:USERPROFILE\custom_scoop" +$env:XDG_CONFIG_HOME = "$Env:USERPROFILE\.config" +Write-Output '# Testing installation with custom directory and XDG_CONFIG_HOME set' & "$WorkingRoot\install.ps1" -ScoopDir $CustomScoopDir Write-Output "$CustomScoopDir\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append +$configFilePath = "$env:XDG_CONFIG_HOME\scoop\config.json" +if (-not (Test-Path -Path $configFilePath)) { + throw 'Scoop config file should exist after installation (XDG)' +} scoop help -Get-Content -Raw -Path "$env:USERPROFILE\.config\scoop\config.json" | Write-Output +Write-Output "Config file: $configFilePath" +Get-Content -Raw -Path $configFilePath | Write-Output diff --git a/install.ps1 b/install.ps1 index c16f16e..ff5febe 100644 --- a/install.ps1 +++ b/install.ps1 @@ -699,8 +699,8 @@ $SCOOP_APP_DIR = "$SCOOP_DIR\apps\scoop\current" # Scoop main bucket directory $SCOOP_MAIN_BUCKET_DIR = "$SCOOP_DIR\buckets\main" # Scoop config file location -$SCOOP_CONFIG_HOME = $env:XDG_CONFIG_HOME, "$env:USERPROFILE\.config" | Select-Object -First 1 -$SCOOP_CONFIG_FILE = "$SCOOP_CONFIG_HOME\scoop\config.json" +$SCOOP_CONFIG_HOME = if ($env:XDG_CONFIG_HOME) { "$env:XDG_CONFIG_HOME\scoop" } else { "$SCOOP_DIR" } +$SCOOP_CONFIG_FILE = "$SCOOP_CONFIG_HOME\config.json" # TODO: Use a specific version of Scoop and the main bucket $SCOOP_PACKAGE_REPO = 'https://github.com/ScoopInstaller/Scoop/archive/master.zip'