aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/scripts/locate.bat
diff options
context:
space:
mode:
Diffstat (limited to 'NvCloth/scripts/locate.bat')
-rw-r--r--NvCloth/scripts/locate.bat39
1 files changed, 39 insertions, 0 deletions
diff --git a/NvCloth/scripts/locate.bat b/NvCloth/scripts/locate.bat
new file mode 100644
index 0000000..50610eb
--- /dev/null
+++ b/NvCloth/scripts/locate.bat
@@ -0,0 +1,39 @@
+@echo off
+setlocal enabledelayedexpansion
+
+set FOLDER_NEEDLE=%~2
+echo looking for ...\%FOLDER_NEEDLE%\
+
+set FOLDER=%~dp0
+set LOOP_COUNT=1
+:rootloop
+if exist "%FOLDER%%FOLDER_NEEDLE%" goto :haverootpath
+set FOLDER=%FOLDER%..\
+set /a LOOP_COUNT=%LOOP_COUNT%+1
+if %LOOP_COUNT% GTR 50 (goto :error)
+goto :rootloop
+
+:haverootpath
+set FOLDER=%FOLDER%\%FOLDER_NEEDLE%\
+pushd %FOLDER%
+set FOLDER=%CD%
+popd
+echo Found %FOLDER%
+:manualfolder
+set returnVal=%FOLDER%
+goto :returnpath
+
+
+:error
+echo Couldn't find folder ...\%FOLDER_NEEDLE%\
+set returnVal=error\%FOLDER_NEEDLE%
+pause
+goto :returnpath
+
+
+:returnpath
+
+( endlocal
+ set "%~1=%returnVal%"
+)
+goto :eof \ No newline at end of file