Open rcarboneras opened 5 years ago
I've made a minor change in the way of creating the folder:
else { if ($true) {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)" }
When using a Git repository, if target doesn't exist, the dependency is downloaded in the current directory and the error is silenced, affecting the path sctructure of your proyect. Unless you check the $Errors variable, you'll never now what is happening.
However, when using PowerShell Gallery, the bellow piece of code does the work in the Save-Module function: When -Force is specified, Path will be created if not available
I propose then to implement the same behaviour in Git.ps1 script with the following lines:
else { if ($Force) {New-Item -ItemType Directory -Name $Dependency.Target -Force | Out-Null Write-Debug "Target folder $($Dependency.Target) created as -Force switch was specified" $Target = Join-Path $PWD "$($Dependency.Target)" } else { $Target = $PWD.Path Write-Debug "Target defaulted to current dir: $Target" } }