72c37458 |
1 | @echo off |
2 | |
3 | rem Helper script to configure environment for building with genproj tool. |
4 | rem Running it requires that Tcl should be in the PATH |
5 | |
6 | SET "OLD_PATH=%PATH%" |
7 | |
8 | rem create env.bat if it does not exist yet |
9 | if exist "%~dp0env.bat" ( |
10 | call "%~dp0env.bat" |
11 | ) else ( |
12 | type "%~dp0adm\templates\env.bat" | findstr /i /v "__CASROOT__" > "%~dp0env.bat" |
13 | ) |
14 | |
15 | rem find Tcl |
16 | set "TCL_EXEC=tclsh.exe" |
17 | for %%X in (%TCL_EXEC%) do (set TCL_FOUND=%%~$PATH:X) |
18 | |
19 | set "TCL_EXEC2=tclsh86.exe" |
20 | if not defined TCL_FOUND ( |
21 | for %%X in (%TCL_EXEC2%) do ( |
22 | set TCL_FOUND=%%~$PATH:X |
23 | set TCL_EXEC=%TCL_EXEC2% |
24 | ) |
25 | ) |
26 | |
27 | rem Prompt the user to specify location of Tcl if not found in PATH |
28 | if not defined TCL_FOUND ( |
29 | set /P TCL_PATH=This script requires Tcl, but tclsh.exe cannot be found in PATH.^ |
30 | |
31 | Please enter path to folder containing tclsh.exe^ |
32 | |
33 | ^: |
34 | rem NOTE: KEEP LINE AFTER "set" ABOVE EMPTY ! |
35 | ) |
36 | |
37 | if exist %TCL_PATH%\tclsh.exe ( |
38 | set "TCL_FOUND=%TCL_PATH%\tclsh.exe" |
39 | ) else if exist %TCL_PATH%\tclsh86.exe ( |
40 | set "TCL_FOUND=%TCL_PATH%\tclsh86.exe" |
41 | ) else ( |
42 | set "TCL_EXEC=%TCL_PATH%\tclsh.exe" |
43 | ) |
44 | |
45 | rem Initialize custom.bat if it does not exist yet |
46 | rem if not exist %%dp0custom.bat ( |
47 | rem echo set "PATH=%%PATH%%;%TCL_PATH%" >%~dp0custom.bat |
48 | rem ) |
49 | |
50 | rem fail if Tcl is not found |
51 | if not defined TCL_FOUND ( |
52 | echo Error: "%TCL_EXEC%" is not found. Please update PATH variable ^(use custom.bat^) |
53 | goto :eof |
54 | ) |
55 | |
56 | :: run GUI tool |
57 | %TCL_FOUND% %~dp0adm/genconf.tcl |
58 | |
59 | SET "PATH=%OLD_PATH%" |