@@ -374,7 +374,24 @@ function Find-UnitySetupInstaller {
374
374
}
375
375
376
376
if ($null -eq $prototypeLink ) {
377
- throw " Could not find archives for Unity version $Version "
377
+ # Attempt to find Unity version and setup links based off builtin_shaders download.
378
+ Write-Verbose " Attempting version search with builtin_shaders fallback"
379
+ foreach ($page in $searchPages ) {
380
+ $webResult = Invoke-WebRequest $page - UseBasicParsing
381
+ $prototypeLink = $webResult.Links | Select-Object - ExpandProperty href - ErrorAction SilentlyContinue | Where-Object {
382
+ $_ -match " builtin_shaders-$ ( $Version ) .zip$"
383
+ }
384
+
385
+ if ($null -ne $prototypeLink ) { break }
386
+ }
387
+
388
+ if ($null -eq $prototypeLink ) {
389
+ throw " Could not find archives for Unity version $Version "
390
+ }
391
+ else {
392
+ # Regex needs to be reconfigured to parse builtin_shaders's url link
393
+ $unitySetupRegEx = " ^(.+)\/([a-z0-9]+)\/builtin_shaders-(\d+)\.(\d+)\.(\d+)([fpb])(\d+).zip$"
394
+ }
378
395
}
379
396
380
397
$linkComponents = $prototypeLink -split $unitySetupRegEx -ne " "
@@ -959,11 +976,18 @@ function Install-UnitySetupInstance {
959
976
960
977
# Move the install from the sparse bundle disk to the install directory.
961
978
if ($currentOS -eq [OperatingSystem ]::Mac) {
979
+ # rsync does not recursively create the directory path.
980
+ if (-not (Test-Path $installPath - PathType Container))
981
+ {
982
+ Write-Verbose " Creating directory $installPath ."
983
+ New-Item $installPath - ItemType Directory - ErrorAction Stop | Out-Null
984
+ }
985
+
962
986
Write-Verbose " Copying install to $installPath ."
963
987
# Copy the files (-r) and recreate symlinks (-l) to the install directory.
964
988
# Preserve permissions (-p) and owner (-o).
965
989
# chmod gives files read permissions.
966
- & sudo rsync - rlpo $volumeInstallPath $installPath -- chmod=+ r -- remove-source - files
990
+ & sudo rsync - rlpo $volumeInstallPath $installPath -- chmod= " +wr " -- remove-source - files
967
991
968
992
Write-Verbose " Freeing sparse bundle disk space and unmounting."
969
993
# Ensure the drive is cleaned up.
0 commit comments