mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 16:39:07 +08:00
Rework vcpkgExtractFile (powershell)
This commit is contained in:
parent
c4c079f86e
commit
2c914ff05a
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user