diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-19 18:46:02 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-19 18:52:17 -0700 |
| commit | b9a0cee78d01df2a879dee3e4e01800fb3cf3391 (patch) | |
| tree | 743d3a1175df2105929cf335419c910439ee2204 /scripts/findFileRecursivelyUp.ps1 | |
| parent | 31e7e219211a17b4c133387bfde77861674776f6 (diff) | |
| download | vcpkg-b9a0cee78d01df2a879dee3e4e01800fb3cf3391.tar.gz vcpkg-b9a0cee78d01df2a879dee3e4e01800fb3cf3391.zip | |
Powershell scripts now detect the root dir via the .vcpkg-root file
Diffstat (limited to 'scripts/findFileRecursivelyUp.ps1')
| -rw-r--r-- | scripts/findFileRecursivelyUp.ps1 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/findFileRecursivelyUp.ps1 b/scripts/findFileRecursivelyUp.ps1 new file mode 100644 index 000000000..788adbf08 --- /dev/null +++ b/scripts/findFileRecursivelyUp.ps1 @@ -0,0 +1,18 @@ +[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" + $currentDir = Split-path $currentDir -Parent +} +Write-Verbose "Found: $currentDir" +return $currentDir
\ No newline at end of file |
