aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2018-02-06 15:44:59 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2018-02-07 17:31:30 -0800
commit815e3caf5573d1149e1f826b359beb9039293307 (patch)
treeb65ce3f6d6b7058e6f289d9d05d285ef91bc7afb /scripts
parent676c861ae65569058014ac5367447464f1fb0877 (diff)
downloadvcpkg-815e3caf5573d1149e1f826b359beb9039293307.tar.gz
vcpkg-815e3caf5573d1149e1f826b359beb9039293307.zip
Merge findFileRecursivelyUp into VcpkgPowershellUtils
Diffstat (limited to 'scripts')
-rw-r--r--scripts/VcpkgPowershellUtils.ps120
-rw-r--r--scripts/bootstrap.ps12
-rw-r--r--scripts/fetchDependency.ps12
-rw-r--r--scripts/findFileRecursivelyUp.ps118
4 files changed, 22 insertions, 20 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1
index 07270dd22..4334df2cc 100644
--- a/scripts/VcpkgPowershellUtils.ps1
+++ b/scripts/VcpkgPowershellUtils.ps1
@@ -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