Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom persist locations #6069

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
9 changes: 8 additions & 1 deletion lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ function currentdir($app, $global) {
"$(appdir $app $global)\$version"
}

function persistdir($app, $global) { "$(basedir $global)\persist\$app" }
function persistdir($app, $global) { if($global) { return "$globalpersistdir\$app" } "$persistdir\$app" }
function usermanifestsdir { "$(basedir)\workspace" }
function usermanifest($app) { "$(usermanifestsdir)\$app.json" }
function cache_path($app, $version, $url) {
Expand Down Expand Up @@ -1464,6 +1464,13 @@ $globaldir = $env:SCOOP_GLOBAL, (get_config GLOBAL_PATH), "$([System.Environment
# Use at your own risk.
$cachedir = $env:SCOOP_CACHE, (get_config CACHE_PATH), "$scoopdir\cache" | Where-Object { $_ } | Select-Object -First 1 | Get-AbsolutePath

# Scoop persist directory
# Note: Setting the SCOOP_PERSIST environment variable to use a shared directory
# may cause problems depending on the app.
# Use at your own risk.
$persistdir = $env:SCOOP_PERSIST, (get_config PERSIST_PATH), "$scoopdir\persist" | Where-Object { $_ } | Select-Object -First 1 | Get-AbsolutePath
$globalpersistdir = $env:SCOOP_PERSIST_GLOBAL, (get_config GLOBAL_PERSIST_PATH), "$globaldir\persist" | Where-Object { $_ } | Select-Object -First 1 | Get-AbsolutePath

# Scoop apps' PATH Environment Variable
$scoopPathEnvVar = switch (get_config USE_ISOLATED_PATH) {
{ $_ -is [string] } { $_.ToUpperInvariant() }
Expand Down
6 changes: 6 additions & 0 deletions libexec/scoop-config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
# cache_path:
# For downloads, defaults to 'cache' folder under Scoop root directory.
#
# persist_path:
# Directories persisted during installation of new versions , defaults to 'persist' folder under Scoop root directory.
#
# global_persist_path:
# Directories persisted during installation of new versions , defaults to 'persist' folder under Scoop global directory.
#
# gh_token:
# GitHub API token used to make authenticated requests.
# This is essential for checkver and similar functions to run without
Expand Down
2 changes: 1 addition & 1 deletion libexec/scoop-export.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $export = @{}
if ($args[0] -eq '-c' -or $args[0] -eq '--config') {
$export.config = $scoopConfig
# Remove machine-specific properties
foreach ($prop in 'last_update', 'root_path', 'global_path', 'cache_path', 'alias') {
foreach ($prop in 'last_update', 'root_path', 'global_path', 'cache_path', 'persist_path', 'global_persist_path', 'alias') {
$export.config.PSObject.Properties.Remove($prop)
}
}
Expand Down