diff --git a/PSDepend/PSDependScripts/Git.ps1 b/PSDepend/PSDependScripts/Git.ps1 index e372425..284ffdf 100644 --- a/PSDepend/PSDependScripts/Git.ps1 +++ b/PSDepend/PSDependScripts/Git.ps1 @@ -93,8 +93,15 @@ if($Dependency.Target -and ($Target = (Get-Item $Dependency.Target -ErrorAction } else { - $Target = $PWD.Path - Write-Debug "Target defaulted to current dir: $Target" +if ($Force) { + New-Item -ItemType Directory -Name (Split-Path $Dependency.Target -Leaf) -Force | Out-Null + Write-Debug "Target folder $($Dependency.Target) created as -Force switch was specified" + $Target = Join-Path $PWD "$(Split-Path $Dependency.Target -Leaf)" + } + else { + $Target = $PWD.Path + Write-Debug "Target defaulted to current dir: $Target" + } } $RepoPath = Join-Path $Target $GitName $GottaInstall = $True