Skip to content

Commit

Permalink
feat: support loading basedirs from config
Browse files Browse the repository at this point in the history
  • Loading branch information
Chawye Hsu authored and r15ch13 committed May 10, 2019
1 parent 7699bea commit f53ffc6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ These settings can be changed through environment variables.
### Install Scoop to a Custom Directory

```powershell
[environment]::setEnvironmentVariable('SCOOP','D:\Applications\Scoop','User')
$env:SCOOP='D:\Applications\Scoop'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
```

### Configure Scoop to install global programs to a Custom Directory

```powershell
[environment]::setEnvironmentVariable('SCOOP_GLOBAL','F:\GlobalScoopApps','Machine')
$env:SCOOP_GLOBAL='F:\GlobalScoopApps'
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
```

## [Documentation](https://github.com/lukesampson/scoop/wiki)
Expand Down
6 changes: 3 additions & 3 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# Old installations should continue to work using the old path.
# There is currently no automatic migration path to deal
# with updating old installations to the new path.
$scoopdir = $env:SCOOP, "$env:USERPROFILE\scoop" | Select-Object -first 1
$scoopdir = $env:SCOOP, (get_config 'rootPath'), "$env:USERPROFILE\scoop" | Select-Object -first 1

$oldscoopdir = "$env:LOCALAPPDATA\scoop"
if((test-path $oldscoopdir) -and !$env:SCOOP) {
$scoopdir = $oldscoopdir
}

$globaldir = $env:SCOOP_GLOBAL, "$env:ProgramData\scoop" | Select-Object -first 1
$globaldir = $env:SCOOP_GLOBAL, (get_config 'globalPath'), "$env:ProgramData\scoop" | Select-Object -first 1

# Note: Setting the SCOOP_CACHE environment variable to use a shared directory
# is experimental and untested. There may be concurrency issues when
# multiple users write and access cached files at the same time.
# Use at your own risk.
$cachedir = $env:SCOOP_CACHE, "$scoopdir\cache" | Select-Object -first 1
$cachedir = $env:SCOOP_CACHE, (get_config 'cachePath'), "$scoopdir\cache" | Select-Object -first 1

$configHome = $env:XDG_CONFIG_HOME, "$env:USERPROFILE\.config" | Select-Object -First 1
$configFile = "$configHome\scoop\config.json"
Expand Down
6 changes: 3 additions & 3 deletions lib/unix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ if(!(is_unix)) {
}

# core.ps1
$scoopdir = $env:SCOOP, (Join-Path $env:HOME "scoop") | Select-Object -first 1
$globaldir = $env:SCOOP_GLOBAL, "/usr/local/scoop" | Select-Object -first 1
$cachedir = $env:SCOOP_CACHE, (Join-Path $scoopdir "cache") | Select-Object -first 1
$scoopdir = $env:SCOOP, (get_config 'rootPath'), (Join-Path $env:HOME "scoop") | Select-Object -first 1
$globaldir = $env:SCOOP_GLOBAL, (get_config 'globalPath'), "/usr/local/scoop" | Select-Object -first 1
$cachedir = $env:SCOOP_CACHE, (get_config 'cachePath'), (Join-Path $scoopdir "cache") | Select-Object -first 1

# core.ps1
function ensure($dir) {
Expand Down
4 changes: 2 additions & 2 deletions libexec/scoop-checkup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ $issues += !(check_long_paths)

$globaldir = New-Object System.IO.DriveInfo($globaldir)
if($globaldir.DriveFormat -ne 'NTFS') {
error "Scoop requires an NTFS volume to work! Please point `$env:SCOOP_GLOBAL variable to another Drive."
error "Scoop requires an NTFS volume to work! Please point `$env:SCOOP_GLOBAL or 'globalPath' variable in '~/.config/scoop/config.json' to another Drive."
$issues++
}

$scoopdir = New-Object System.IO.DriveInfo($scoopdir)
if($scoopdir.DriveFormat -ne 'NTFS') {
error "Scoop requires an NTFS volume to work! Please point `$env:SCOOP variable to another Drive."
error "Scoop requires an NTFS volume to work! Please point `$env:SCOOP or 'rootPath' variable in '~/.config/scoop/config.json' to another Drive."
$issues++
}

Expand Down

0 comments on commit f53ffc6

Please sign in to comment.