[macOS] Add Xcode symlinks to the Software Report (#10736)

This commit is contained in:
Erik Bershel
2024-10-09 12:54:34 +02:00
committed by GitHub
parent 20de906028
commit 52279a9048

View File

@@ -94,12 +94,26 @@ function Build-XcodeTable {
$xcodeList = $xcodeInfo.Values | ForEach-Object { $_.VersionInfo } | Sort-Object $sortRules
return $xcodeList | ForEach-Object {
$defaultPostfix = If ($_.IsDefault) { " (default)" } else { "" }
$betaPostfix = If ($_.IsStable) { "" } else { " (beta)" }
$defaultPostfix = if ($_.IsDefault) { " (default)" } else { "" }
$betaPostfix = if ($_.IsStable) { "" } else { " (beta)" }
$targetPath = $_.Path
$symlinks = @()
Get-ChildItem -Path "/Applications" | ForEach-Object {
if ($_.LinkType -eq 'SymbolicLink') {
$linkTarget = & readlink $_.FullName
if ($linkTarget -eq $targetPath) {
$symlinks += $_.FullName
}
}
}
if ($null -eq $symlinks) {
$symlinks = @("N/A")
}
return [PSCustomObject] @{
"Version" = $_.Version.ToString() + $betaPostfix + $defaultPostfix
"Build" = $_.Build
"Path" = $_.Path
"Symlinks" = [String]::Join("<br>", $symlinks)
}
}
}