Private/Get-BinaryDependencies.ps1
|
function Get-BinaryDependencies { param([string]$Path) if (-not (Test-Path -LiteralPath $Path)) { return @() } $fileInfo = /usr/bin/file -b "$Path" 2>$null if ($fileInfo -notmatch "Mach-O") { return @() } $deps = /usr/bin/otool -L "$Path" 2>$null | Select-Object -Skip 1 | ForEach-Object { ($_ -replace '^\s+', '') -replace '\s+\(.*$', '' } | Where-Object { $_ -and $_ -ne $Path } return @($deps) } |