@@ -35,6 +35,8 @@ TBorlandCompiler = class(TCompilerBase)
35
35
var
36
36
fId: TCompilerID;
37
37
{ Identifies compiler}
38
+ // Flags whether user permits compiler to be auto installed.
39
+ fCanAutoInstall: Boolean;
38
40
function InstallPathFromReg (const RootKey: HKEY): string;
39
41
{ Gets compiler install root path from given registry root key, if present.
40
42
@param RootKey [in] Given registry root key.
@@ -70,10 +72,35 @@ TBorlandCompiler = class(TCompilerBase)
70
72
@param Obj Compiler object to copy.
71
73
}
72
74
{ ICompilerAutoDetect }
75
+ // / <summary>Detects and records path to command line compiler exe file,
76
+ // / if compiler is registered as installed.</summary>
77
+ // / <returns>Boolean. True if compiler is registered as installed, False
78
+ // / otherwise.</returns>
79
+ // / <remarks>
80
+ // / <para>Does not check if the compiler exe file actually exists.</para>
81
+ // / <para>Does not set compiler exe file if compiler is not installed.
82
+ // / </para>
83
+ // / <para>Method of ICompilerAutoDetect.</para>
84
+ // / </remarks>
73
85
function DetectExeFile : Boolean;
74
- { Detects and records path to command line compiler if present.
75
- @return True if compiler path found, false otherwise.
76
- }
86
+ // / <summary>Checks if the compiler is installed on the user's system.
87
+ // / </summary>
88
+ // / <returns>Boolean. True if compiler is physically installed, False
89
+ // / otherwise.</returns>
90
+ // / <remarks>
91
+ // / <para>Checks if compiler exe is actually present.</para>
92
+ // / <para>Method of ICompilerAutoDetect.</para>
93
+ // / </remarks>
94
+ function IsInstalled : Boolean;
95
+ // / <summary>Checks if the compiler is permitted to be automatically
96
+ // / installed.</summary>
97
+ // / <remarks>Method of ICompilerAutoDetect.</remarks>
98
+ function GetCanAutoInstall : Boolean;
99
+ // / <summary>Determines whether the compiler can be automatically
100
+ // / installed.</summary>
101
+ // / <remarks>Method of ICompilerAutoDetect.</remarks>
102
+ procedure SetCanAutoInstall (const Value : Boolean);
103
+
77
104
{ ICompiler }
78
105
function GetDefaultSwitches : string; override;
79
106
{ Returns default command line switches for compiler.
@@ -97,7 +124,7 @@ implementation
97
124
98
125
uses
99
126
// Delphi
100
- SysUtils, Registry,
127
+ SysUtils, Registry, IOUtils,
101
128
// Project
102
129
UIStringList, UStrUtils, USystemInfo;
103
130
@@ -118,6 +145,7 @@ constructor TBorlandCompiler.CreateCopy(const Obj: TBorlandCompiler);
118
145
begin
119
146
inherited CreateCopy(Obj);
120
147
fId := Obj.GetID;
148
+ fCanAutoInstall := Obj.GetCanAutoInstall;
121
149
end ;
122
150
123
151
procedure TBorlandCompiler.DeleteObjFiles (const Path, Project: string);
@@ -144,6 +172,11 @@ function TBorlandCompiler.DetectExeFile: Boolean;
144
172
SetExecFile(ExePath);
145
173
end ;
146
174
175
+ function TBorlandCompiler.GetCanAutoInstall : Boolean;
176
+ begin
177
+ Result := fCanAutoInstall;
178
+ end ;
179
+
147
180
function TBorlandCompiler.GetDefaultSwitches : string;
148
181
{ Returns default command line switches for Borland compilers.
149
182
@return Switches separated by commas.
@@ -211,6 +244,15 @@ function TBorlandCompiler.InstallPathFromReg(const RootKey: HKEY): string;
211
244
end ;
212
245
end ;
213
246
247
+ function TBorlandCompiler.IsInstalled : Boolean;
248
+ var
249
+ ExePath: string;
250
+ begin
251
+ if not GetExePathIfInstalled(ExePath) then
252
+ Exit(False);
253
+ Result := TFile.Exists(ExePath, False);
254
+ end ;
255
+
214
256
function TBorlandCompiler.SearchDirParams : string;
215
257
{ One of more parameters that define any search directories to be passed to
216
258
compiler on command line.
@@ -228,5 +270,10 @@ function TBorlandCompiler.SearchDirParams: string;
228
270
+ ' ' + StrQuoteSpaced(' -R' + Dirs.GetText(' ;' , False));
229
271
end ;
230
272
273
+ procedure TBorlandCompiler.SetCanAutoInstall (const Value : Boolean);
274
+ begin
275
+ fCanAutoInstall := Value ;
276
+ end ;
277
+
231
278
end .
232
279
0 commit comments