File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/PSAppDeployToolkit.Tools/Public Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ function Convert-ADTDeployment
139139 try
140140 {
141141 $Path = (Resolve-Path - LiteralPath $Path ).Path
142- $Destination = ( Resolve- Path - LiteralPath $Destination ). Path
142+ $Destination = $ExecutionContext .SessionState. Path.GetUnresolvedProviderPathFromPSPath ( $Destination ) # This method resolves relative paths that might not exist and also accepts PSPaths unlike [System.IO. Path]::GetFullPath()
143143 $tempFolderName = " Convert-ADTDeployment_$ ( [System.IO.Path ]::GetRandomFileName().Replace(' .' , ' ' )) "
144144 $tempFolderPath = [System.IO.Path ]::Combine([System.IO.Path ]::GetTempPath(), $tempFolderName )
145145
@@ -340,6 +340,13 @@ function Convert-ADTDeployment
340340 Write-Verbose - Message " Removing temp script [$inputScriptPath ]"
341341 Remove-Item - LiteralPath $inputScriptPath - Force
342342
343+ $DestinationParent = Split-Path - Path $Destination - Parent
344+ if (! (Test-Path - LiteralPath $DestinationParent - PathType Container))
345+ {
346+ Write-Verbose - Message " Creating parent folder [$DestinationParent ]"
347+ New-Item - Path $DestinationParent - ItemType Directory - Force | Out-Null
348+ }
349+
343350 if ($Path -like ' *.ps1' )
344351 {
345352 Write-Verbose - Message " Moving file [$outputScriptPath ] to [$Destination ]"
@@ -409,7 +416,7 @@ function Convert-ADTDeployment
409416 }
410417 finally
411418 {
412- if (Test-Path - LiteralPath $tempFolderPath )
419+ if (( Get-Variable - Name ' tempFolderPath ' - ErrorAction Ignore) -and ( Test-Path - LiteralPath $tempFolderPath ) )
413420 {
414421 Write-Verbose - Message " Removing temp folder [$tempFolderPath ]"
415422 Remove-Item - Path $tempFolderPath - Recurse - Force - ErrorAction SilentlyContinue
You can’t perform that action at this time.
0 commit comments