[macOS] Implement new directories hierarchy (#8741)

This commit is contained in:
Shamil Mubarakshin
2023-11-15 12:12:28 +01:00
committed by GitHub
parent 5d40b1e213
commit 8d6a01b370
133 changed files with 1713 additions and 1677 deletions

View File

@@ -0,0 +1,27 @@
function Get-JavaVersions {
$defaultJavaPath = (Get-Item env:JAVA_HOME).value
$os = Get-OSVersion
if ($os.IsVenturaArm64 -or $os.IsSonomaArm64) {
$javaVersions = Get-Item env:JAVA_HOME_*_arm64
} else {
$javaVersions = Get-Item env:JAVA_HOME_*_X64
}
$sortRules = @{
Expression = { [Int32]$_.Name.Split("_")[2] }
Descending = $false
}
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
$javaPath = $_.Value
# Take semver from the java path
$version = $javaPath.split('/')[5]
$fullVersion = $version.Replace('-', '+')
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
[PSCustomObject] @{
"Version" = $fullVersion + $defaultPostfix
"Environment Variable" = $_.Name
}
}
}