From 9c3e47dde102d036306471bab71f5fa6a6dc4437 Mon Sep 17 00:00:00 2001 From: Antonio Date: Sat, 27 Jun 2020 17:32:31 +0200 Subject: [PATCH] Create .unitysetup folder if not exist Check and create .unitysetup folder before create sparsebundle to mount --- UnitySetup/UnitySetup.psm1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 770c4b4..e77efd5 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -1005,6 +1005,12 @@ function Install-UnitySetupInstance { if (-not $installPath.EndsWith([io.path]::DirectorySeparatorChar)) { $installPath += [io.path]::DirectorySeparatorChar } + + # Make sure the folder .unitysetup exist before create sparsebundle + if (-not (Test-Path $Cache -PathType Container)) { + Write-Verbose "Creating directory $Cache." + New-Item $Cache -ItemType Directory -ErrorAction Stop | Out-Null + } # Creating sparse bundle to host installing Unity in other locations $unitySetupBundlePath = [io.path]::Combine($Cache, "UnitySetup.sparsebundle")