Skip to content

Commit 059de66

Browse files
Hope-IT-WorksCopilot
andcommitted
Fixed install path
Co-authored-by: Copilot <copilot@github.com>
1 parent bfe5f03 commit 059de66

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Invoke-WCMPSetup.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,16 @@ if(!([System.Environment]::Is64BitOperatingSystem) -or !(([System.Environment]::
208208
}
209209

210210
# Set root path for setup with fallback to the default path
211-
if(!(Test-Path -PathType Container -Path $WCMP.Config.Path)){
211+
if($WCMP.Config.Path -and !(Test-Path -PathType Container -Path $WCMP.Config.Path)){
212+
try {
213+
$WCMP.Info('Creating installation directory "'+$WCMP.Config.Path+'"...')
214+
New-Item -Path $WCMP.Config.Path -ItemType Directory | Out-Null
215+
$WCMP.Info('Installation directory created.')
216+
} catch {
217+
$WCMP.Warn('Could not create the specified path "'+$WCMP.Config.Path+'". Falling back to current directory.')
218+
$WCMP.Config.Path = $WCMP.DefaultConfig.Path
219+
}
220+
} elseif(!($WCMP.Config.Path)) {
212221
$WCMP.Config.Path = $WCMP.DefaultConfig.Path
213222
}
214223

0 commit comments

Comments
 (0)