From 52279a9048d6acd2e233155173be0b51893f0442 Mon Sep 17 00:00:00 2001 From: Erik Bershel <110455084+erik-bershel@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:54:34 +0200 Subject: [PATCH] [macOS] Add Xcode symlinks to the Software Report (#10736) --- .../scripts/docs-gen/SoftwareReport.Xcode.psm1 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/images/macos/scripts/docs-gen/SoftwareReport.Xcode.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Xcode.psm1 index 3384acb8f..b3f918676 100644 --- a/images/macos/scripts/docs-gen/SoftwareReport.Xcode.psm1 +++ b/images/macos/scripts/docs-gen/SoftwareReport.Xcode.psm1 @@ -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("
", $symlinks) } } }