# Fix symlink errors in winCodeSign extraction # This script finds and fixes the extraction errors $cacheDir = "$env:LOCALAPPDATA\electron-builder\Cache\winCodeSign" if (-not (Test-Path $cacheDir)) { Write-Host "Cache directory not found: $cacheDir" exit 0 } # Find all extracted directories $extractedDirs = Get-ChildItem -Path $cacheDir -Directory -ErrorAction SilentlyContinue foreach ($dir in $extractedDirs) { $symlinks = @( "darwin\10.12\lib\libcrypto.dylib", "darwin\10.12\lib\libssl.dylib" ) foreach ($symlink in $symlinks) { $symlinkPath = Join-Path $dir.FullName $symlink $symlinkDir = Split-Path $symlinkPath -Parent # Create directory if it doesn't exist if (-not (Test-Path $symlinkDir)) { New-Item -ItemType Directory -Path $symlinkDir -Force | Out-Null Write-Host "Created directory: $symlinkDir" } # Create placeholder file if symlink doesn't exist if (-not (Test-Path $symlinkPath)) { New-Item -ItemType File -Path $symlinkPath -Force | Out-Null Write-Host "Created placeholder for: $symlink" } else { # If it exists but is a broken symlink, remove and recreate $item = Get-Item $symlinkPath -ErrorAction SilentlyContinue if ($item -and $item.LinkType -eq "SymbolicLink") { try { $target = $item.Target if (-not (Test-Path $target)) { Remove-Item $symlinkPath -Force -ErrorAction SilentlyContinue New-Item -ItemType File -Path $symlinkPath -Force | Out-Null Write-Host "Fixed broken symlink: $symlink" } } catch { Remove-Item $symlinkPath -Force -ErrorAction SilentlyContinue New-Item -ItemType File -Path $symlinkPath -Force | Out-Null Write-Host "Fixed broken symlink: $symlink" } } } } } Write-Host "Symlink fixes applied" exit 0