-
Notifications
You must be signed in to change notification settings - Fork 63
/
DN.Installer.Delphinus.pas
77 lines (65 loc) · 1.83 KB
/
DN.Installer.Delphinus.pas
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
unit DN.Installer.Delphinus;
interface
uses
DN.Types,
DN.Installer,
DN.Compiler.Intf,
DN.ProjectInfo.Intf,
DN.VariableResolver.Compiler.Factory;
type
TDNDelphinusInstaller = class(TDNInstaller)
private
FRegistryKey: string;
protected
function InstallBPL(const ABPL: string): Boolean; override;
function GetSupportedPlatforms: TDNCompilerPlatforms; override;
function GetBPLDir(APlatform: TDNCompilerPlatform): string; override;
function GetDCPDir(APlatform: TDNCompilerPlatform): string; override;
public
constructor Create(const ACompiler: IDNCompiler;
const AVariableResolverFactory: TDNCompilerVariableResolverFacory;
const ARegistryKey: string); reintroduce;
end;
implementation
uses
Registry,
IOUtils,
SysUtils;
{ TDNDelphinusInstaller }
constructor TDNDelphinusInstaller.Create(const ACompiler: IDNCompiler;
const AVariableResolverFactory: TDNCompilerVariableResolverFacory;
const ARegistryKey: string);
begin
inherited Create(ACompiler, AVariableResolverFactory);
FRegistryKey := ARegistryKey;
end;
function TDNDelphinusInstaller.GetBPLDir(
APlatform: TDNCompilerPlatform): string;
begin
Result := TPath.Combine(GetTargetDirectory(), 'Bpl');
end;
function TDNDelphinusInstaller.GetDCPDir(
APlatform: TDNCompilerPlatform): string;
begin
Result := TPath.Combine(GetTargetDirectory(), 'Dcp');
end;
function TDNDelphinusInstaller.GetSupportedPlatforms: TDNCompilerPlatforms;
begin
Result := [cpWin32];
end;
function TDNDelphinusInstaller.InstallBPL(const ABPL: string): Boolean;
var
LRegistry: TRegistry;
begin
LRegistry := TRegistry.Create();
try
Result := LRegistry.OpenKey(TPath.Combine(FRegistryKey, 'Known Packages'), False);
if Result then
begin
LRegistry.WriteString(ABPL, ExtractFileName(ABPL));
end;
finally
LRegistry.Free;
end;
end;
end.