From b9a0cee78d01df2a879dee3e4e01800fb3cf3391 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 19 Sep 2016 18:46:02 -0700 Subject: Powershell scripts now detect the root dir via the .vcpkg-root file --- scripts/findFileRecursivelyUp.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/findFileRecursivelyUp.ps1 (limited to 'scripts/findFileRecursivelyUp.ps1') 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 -- cgit v1.2.3