From 91f82d7ce03868edd2b013a62ea0ed3afe420c48 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Sun, 29 Mar 2015 15:40:50 -0500 Subject: [PATCH] (GH-167) Get-ChocolateyWebFile create directory If the fileFullPath directory doesn't exist, create it. --- .../helpers/functions/Get-ChocolateyWebFile.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 index 03ac193554..217d19a0c2 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 @@ -90,6 +90,15 @@ param( $checksumType = $checksumType64 } + try { + $fileDirectory = $([System.IO.Path]::GetDirectoryName($fileFullPath)) + if (!(Test-Path($fileDirectory))) { + [System.IO.Directory]::CreateDirectory($fileDirectory) | Out-Null + } + } catch { + Write-Host "Attempt to create directory failed for '$fileFullPath'." + } + $forceX86 = $env:chocolateyForceX86; if ($forceX86) { Write-Debug "User specified -x86 so forcing 32 bit"