[macOS] Rebuilding Launch Services database (#4588)

This commit is contained in:
Sergey Dolin
2021-12-01 12:58:26 +05:00
committed by GitHub
parent f4306a6c40
commit 6f662479c8
2 changed files with 17 additions and 1 deletions

View File

@@ -175,6 +175,17 @@ function Build-XcodeSymlinks {
} }
} }
function Rebuild-XcodeLaunchServicesDb {
param(
[Parameter(Mandatory)]
[string]$Version
)
$xcodePath = Get-XcodeRootPath -Version $Version
$lsregister = '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister'
Get-ChildItem -Recurse -Filter "*.app" $xcodePath | Foreach-Object { & $lsregister -f $_.FullName}
}
function Build-ProvisionatorSymlink { function Build-ProvisionatorSymlink {
param( param(
[Parameter(Mandatory)] [Parameter(Mandatory)]

View File

@@ -51,6 +51,11 @@ $xcodeVersions | ForEach-Object {
} }
} }
Write-Host "Rebuilding Launch Services database ..."
$xcodeVersions | ForEach-Object {
Rebuild-XcodeLaunchServicesDb -Version $_.link
}
Write-Host "Setting default Xcode to $defaultXcode" Write-Host "Setting default Xcode to $defaultXcode"
Switch-Xcode -Version $defaultXcode Switch-Xcode -Version $defaultXcode
New-Item -Path "/Applications/Xcode.app" -ItemType SymbolicLink -Value (Get-XcodeRootPath -Version $defaultXcode) | Out-Null New-Item -Path "/Applications/Xcode.app" -ItemType SymbolicLink -Value (Get-XcodeRootPath -Version $defaultXcode) | Out-Null