-
Notifications
You must be signed in to change notification settings - Fork 220
/
InitEnvironment.bat
113 lines (100 loc) · 3.67 KB
/
InitEnvironment.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@echo off
REM ------------
REM Init ALBaseDir
REM ------------
set ALBaseDir=%~dp0
IF "%ALBaseDir:~-1%"=="\" SET ALBaseDir=%ALBaseDir:~0,-1%
if not exist "%ALBaseDir%\Source\Alcinoe.inc" goto ERROR
REM ---------------
REM Call rsvars.bat
REM ---------------
setlocal enabledelayedexpansion
set LocalDelphiName=
set LocalDelphiVersion=%ALDelphiVersion%
set LocalDelphiDir=
IF "%LocalDelphiVersion%"=="" (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\23.0" /v "RootDir"') do set LocalDelphiDir=%%B
IF EXIST "!LocalDelphiDir!\bin\rsvars.bat" (
ECHO Found Delphi 12 Athens
set LocalDelphiName=Athens
set LocalDelphiVersion=23.0
) ELSE (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\22.0" /v "RootDir"') do set LocalDelphiDir=%%B
IF EXIST "!LocalDelphiDir!\bin\rsvars.bat" (
ECHO Found Delphi 11 Alexandria
set LocalDelphiName=Alexandria
set LocalDelphiVersion=22.0
) ELSE (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\21.0" /v "RootDir"') do set LocalDelphiDir=%%B
IF EXIST "!LocalDelphiDir!\bin\rsvars.bat" (
ECHO Found Delphi 10.4 Sydney
set LocalDelphiName=Sydney
set LocalDelphiVersion=21.0
) ELSE (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\20.0" /v "RootDir"') do set LocalDelphiDir=%%B
IF EXIST "!LocalDelphiDir!\bin\rsvars.bat" (
ECHO Found Delphi 10.3 Rio
set LocalDelphiName=Rio
set LocalDelphiVersion=20.0
) ELSE (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\19.0" /v "RootDir"') do set LocalDelphiDir=%%B
IF EXIST "!LocalDelphiDir!\bin\rsvars.bat" (
ECHO Found Delphi 10.2 Tokyo
set LocalDelphiName=Tokyo
set LocalDelphiVersion=19.0
) ELSE (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\18.0" /v "RootDir"') do set LocalDelphiDir=%%B
IF EXIST "!LocalDelphiDir!\bin\rsvars.bat" (
ECHO Found Delphi 10.1 Berlin
set LocalDelphiName=Berlin
set LocalDelphiVersion=18.0
) ELSE (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\17.0" /v "RootDir"') do set LocalDelphiDir=%%B
IF EXIST "!LocalDelphiDir!\bin\rsvars.bat" (
ECHO Found Delphi 10 Seattle
set LocalDelphiName=Seattle
set LocalDelphiVersion=17.0
)))))))
) ELSE (
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\WOW6432Node\Embarcadero\BDS\%LocalDelphiVersion%" /v "RootDir"') do set LocalDelphiDir=%%B
IF "%LocalDelphiVersion%"=="23.0" (
set LocalDelphiName=Athens
) ELSE (
IF "%LocalDelphiVersion%"=="22.0" (
set LocalDelphiName=Alexandria
) ELSE (
IF "%LocalDelphiVersion%"=="21.0" (
set LocalDelphiName=Sydney
) ELSE (
IF "%LocalDelphiVersion%"=="20.0" (
set LocalDelphiName=Rio
) ELSE (
IF "%LocalDelphiVersion%"=="19.0" (
set LocalDelphiName=Tokyo
) ELSE (
IF "%LocalDelphiVersion%"=="18.0" (
set LocalDelphiName=Berlin
) ELSE (
IF "%LocalDelphiVersion%"=="17.0" (
set LocalDelphiName=Seattle
)))))))
)
endlocal & set "ALDelphiName=%LocalDelphiName%" & set "ALDelphiVersion=%LocalDelphiVersion%" & set "ALDelphiDir=%LocalDelphiDir%"
IF "%ALDelphiName%"=="" set ErrorFlag=1
IF "%ALDelphiVersion%"=="" set ErrorFlag=1
IF "%ALDelphiDir%"=="" set ErrorFlag=1
IF "%ErrorFlag%"=="1" (
ECHO Could not found Delphi
goto ERROR
)
CALL "%ALDelphiDir%\bin\rsvars.bat"
IF ERRORLEVEL 1 goto ERROR
goto FINISHED
REM -------------------
REM FINISHED/ERROR/EXIT
REM -------------------
:ERROR
EXIT /B 1
:FINISHED
goto EXIT
:EXIT