diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-02-07 17:47:53 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-02-07 17:47:53 -0800 |
| commit | 1e3435e32bc96ad59534238c45ebe00c708daf37 (patch) | |
| tree | 537fa027b41db1a3c7b12b50445d6955a518b999 /scripts | |
| parent | 116914e110e06183eaa8626accf1403637b6b681 (diff) | |
| parent | 3aac3957ae9053eb3ffb97bcc49148e7b0a4c050 (diff) | |
| download | vcpkg-1e3435e32bc96ad59534238c45ebe00c708daf37.tar.gz vcpkg-1e3435e32bc96ad59534238c45ebe00c708daf37.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/VcpkgPowershellUtils.ps1 | 28 | ||||
| -rw-r--r-- | scripts/bootstrap.ps1 | 2 | ||||
| -rw-r--r-- | scripts/fetchDependency.ps1 | 2 | ||||
| -rw-r--r-- | scripts/findFileRecursivelyUp.ps1 | 18 |
4 files changed, 26 insertions, 24 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 07270dd22..bed78b198 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -190,10 +190,10 @@ function vcpkgInvokeCommandClean() Write-Verbose "Clean-Executing: ${executable} ${arguments}" $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition $cleanEnvScript = "$scriptsDir\VcpkgPowershellUtils-ClearEnvironment.ps1" - $command = "& `"$cleanEnvScript`"; & `"$executable`" $arguments" - $bytes = [System.Text.Encoding]::Unicode.GetBytes($command) - $encodedCommand = [Convert]::ToBase64String($bytes) - $arg = "-NoProfile -ExecutionPolicy Bypass -encodedCommand $encodedCommand" + $tripleQuotes = "`"`"`"" + $argumentsWithEscapedQuotes = $arguments -replace "`"", $tripleQuotes + $command = ". $tripleQuotes$cleanEnvScript$tripleQuotes; & $tripleQuotes$executable$tripleQuotes $argumentsWithEscapedQuotes" + $arg = "-NoProfile", "-ExecutionPolicy Bypass", "-command $command" $process = Start-Process -FilePath powershell.exe -ArgumentList $arg -PassThru -NoNewWindow Wait-Process -InputObject $process @@ -226,3 +226,23 @@ function vcpkgFormatElapsedTime([TimeSpan]$ts) throw $ts } + +function vcpkgFindFileRecursivelyUp() +{ + param( + [ValidateNotNullOrEmpty()] + [Parameter(Mandatory=$true)][string]$startingDir, + [ValidateNotNullOrEmpty()] + [Parameter(Mandatory=$true)][string]$filename + ) + + $currentDir = $startingDir + + while (!($currentDir -eq "") -and !(Test-Path "$currentDir\$filename")) + { + Write-Verbose "Examining $currentDir for $filename" + $currentDir = Split-path $currentDir -Parent + } + Write-Verbose "Examining $currentDir for $filename - Found" + return $currentDir +} diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index 03f05d50b..0df2a2a99 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -6,7 +6,7 @@ param( $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition . "$scriptsDir\VcpkgPowershellUtils.ps1" -$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root +$vcpkgRootDir = vcpkgFindFileRecursivelyUp $scriptsDir .vcpkg-root Write-Verbose("vcpkg Path " + $vcpkgRootDir) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index ad0b774d4..bfc0f733a 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -7,7 +7,7 @@ $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition . "$scriptsDir\VcpkgPowershellUtils.ps1" Write-Verbose "Fetching dependency: $Dependency" -$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root +$vcpkgRootDir = vcpkgFindFileRecursivelyUp $scriptsDir .vcpkg-root $downloadsDir = "$vcpkgRootDir\downloads" diff --git a/scripts/findFileRecursivelyUp.ps1 b/scripts/findFileRecursivelyUp.ps1 deleted file mode 100644 index 4b6409e8c..000000000 --- a/scripts/findFileRecursivelyUp.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -[CmdletBinding()] -param( - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory=$true)][string]$startingDir, - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory=$true)][string]$filename -) - -$ErrorActionPreference = "Stop" -$currentDir = $startingDir - -while (!($currentDir -eq "") -and !(Test-Path "$currentDir\$filename")) -{ - Write-Verbose "Examining $currentDir for $filename" - $currentDir = Split-path $currentDir -Parent -} -Write-Verbose "Examining $currentDir for $filename - Found" -return $currentDir
\ No newline at end of file |
