Skip to content

Commit 48bb96a

Browse files
Ash258r15ch13
authored andcommitted
feat: Add configuration option for default architecture (#3778)
- Closes #3770 - New available command: `scoop config 'default-architecture' '32bit|64bit'`
1 parent e0c5ac2 commit 48bb96a

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

lib/manifest.ps1

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,20 @@ function install_info($app, $version, $global) {
5959
}
6060

6161
function default_architecture {
62-
if ([Environment]::Is64BitOperatingSystem) { return "64bit" }
63-
"32bit"
62+
$arch = get_config 'default-architecture'
63+
$system = if ([Environment]::Is64BitOperatingSystem) { '64bit' } else { '32bit' }
64+
if ($null -eq $arch) {
65+
$arch = $system
66+
} else {
67+
try {
68+
$arch = ensure_architecture $arch
69+
} catch {
70+
warn 'Invalid default architecture configured. Determining default system architecture'
71+
$arch = $system
72+
}
73+
}
74+
75+
return $arch
6476
}
6577

6678
function arch_specific($prop, $manifest, $architecture) {

0 commit comments

Comments
 (0)