@@ -40,6 +40,15 @@ TBorlandCompiler = class(TCompilerBase)
40
40
@param RootKey [in] Given registry root key.
41
41
@return Required root path or '' if not compiler not installed.
42
42
}
43
+ // / <summary>Gets the path to the compiler exe file if the compiler is
44
+ // / registered as installed on the user's computer.</summary>
45
+ // / <param name="ExePath">string [out] Set to path to compiler executable
46
+ // / file. Empty string if compiler not installed.</param>
47
+ // / <returns>Boolean. True if compiler is registered as installed or False
48
+ // / otherwise.</returns>
49
+ // / <remarks>Does not check if compiler exe is actually present, just if
50
+ // / it is registered.</remarks>
51
+ function GetExePathIfInstalled (out ExePath: string): Boolean;
43
52
strict protected
44
53
function SearchDirParams : string; override;
45
54
{ One of more parameters that define any search directories to be passed
@@ -128,17 +137,11 @@ function TBorlandCompiler.DetectExeFile: Boolean;
128
137
@return True if compiler path found, false otherwise.
129
138
}
130
139
var
131
- InstDir : string; // installation root directory
140
+ ExePath : string;
132
141
begin
133
- // try HKLM
134
- InstDir := InstallPathFromReg(HKEY_LOCAL_MACHINE);
135
- if InstDir = ' ' then
136
- // in case install was for user only, try HKCU
137
- InstDir := InstallPathFromReg(HKEY_CURRENT_USER);
138
- if InstDir = ' ' then
139
- Exit(False);
140
- SetExecFile(IncludeTrailingPathDelimiter(InstDir) + ' Bin\DCC32.exe' );
141
- Result := True;
142
+ Result := GetExePathIfInstalled(ExePath);
143
+ if Result then
144
+ SetExecFile(ExePath);
142
145
end ;
143
146
144
147
function TBorlandCompiler.GetDefaultSwitches : string;
@@ -161,6 +164,22 @@ function TBorlandCompiler.GetDefaultSwitches: string;
161
164
+ ' -$P+' ; // Open string params ON
162
165
end ;
163
166
167
+ function TBorlandCompiler.GetExePathIfInstalled (out ExePath: string): Boolean;
168
+ var
169
+ InstDir: string;
170
+ begin
171
+ ExePath := ' ' ;
172
+ // try HKLM
173
+ InstDir := InstallPathFromReg(HKEY_LOCAL_MACHINE);
174
+ if InstDir = ' ' then
175
+ // in case install was for user only, try HKCU
176
+ InstDir := InstallPathFromReg(HKEY_CURRENT_USER);
177
+ if InstDir = ' ' then
178
+ Exit(False);
179
+ ExePath := TPath.Combine(InstDir, ' Bin\DCC32.exe' );
180
+ Result := True;
181
+ end ;
182
+
164
183
function TBorlandCompiler.GetID : TCompilerID;
165
184
{ Provides the unique id of the compiler.
166
185
@return Compiler id.
0 commit comments