aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-11-27 00:42:21 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-11-27 00:42:39 -0800
commit2c914ff05af3b2209eb11b6ba61b43eb46033cb3 (patch)
tree7d923d4176f1e8399fb04abb6ede9cae2ac4ba6b /scripts
parentc4c079f86eac8215040173d6707900d8983ea7fc (diff)
downloadvcpkg-2c914ff05af3b2209eb11b6ba61b43eb46033cb3.tar.gz
vcpkg-2c914ff05af3b2209eb11b6ba61b43eb46033cb3.zip
Rework vcpkgExtractFile (powershell)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/VcpkgPowershellUtils.ps112
-rw-r--r--scripts/fetchDependency.ps13
2 files changed, 7 insertions, 8 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1
index d431c3b45..0e53ff620 100644
--- a/scripts/VcpkgPowershellUtils.ps1
+++ b/scripts/VcpkgPowershellUtils.ps1
@@ -19,7 +19,7 @@ function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][stri
return
}
- if (!(Test-Path $dirPath))
+ if (!(Test-Path $parentDir))
{
New-Item -ItemType Directory -Path $parentDir | Out-Null
}
@@ -157,9 +157,7 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file,
[Parameter(Mandatory=$true)][string]$destinationDir)
{
vcpkgCreateParentDirectoryIfNotExists $destinationDir
- $baseName = (Get-ChildItem $file).BaseName
- $destination = "$destinationDir\$baseName"
- $destinationPartial = "$destination-partially_extracted"
+ $destinationPartial = "$destinationDir-partially_extracted"
vcpkgRemoveDirectory $destinationPartial
vcpkgCreateDirectoryIfNotExists $destinationPartial
@@ -192,12 +190,12 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file,
{
Move-Item -Path "$destinationPartial\*" -Destination $destinationDir
vcpkgRemoveDirectory $destinationPartial
- return $destination
+ return $destinationDir
}
else
{
- Rename-Item -Path $destinationPartial -NewName $baseName
- return $destination
+ Move-Item -Path $destinationPartial -Destination $destinationDir
+ return $destinationDir
}
}
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1
index 744439bb7..830ec7064 100644
--- a/scripts/fetchDependency.ps1
+++ b/scripts/fetchDependency.ps1
@@ -88,7 +88,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
{
if (-not (Test-Path $executableFromDownload))
{
- vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir
+ $extractFolderName = (Get-ChildItem $downloadPath).BaseName
+ vcpkgExtractFile -File $downloadPath -DestinationDir "$downloadsDir\$extractFolderName"
}
}
elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z)