-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfigurePkgConfig.pas
48 lines (44 loc) · 1.41 KB
/
ConfigurePkgConfig.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
var
AppPath: string;
procedure ReplacePlaceholderInPkgConfig;
var
PkgConfigFile: TStringList;
Index: Integer;
ModifiedAppPath: string;
begin
// Read the contents of the liblite-string.pc file
PkgConfigFile := TStringList.Create;
try
PkgConfigFile.LoadFromFile(ExpandConstant('{app}\lib\pkgconfig\liblite-string.pc'));
// Modify the installation prefix to match the chosen installation destination
if PkgConfigFile.Count > 0 then
begin
// Replace backslashes with forward slashes
ModifiedAppPath := '';
for Index := 1 to Length(AppPath) do
begin
if AppPath[Index] = '\' then
ModifiedAppPath := ModifiedAppPath + '/'
else
ModifiedAppPath := ModifiedAppPath + AppPath[Index];
end;
// Update the prefix
PkgConfigFile[0] := 'prefix = "' + ModifiedAppPath + '"';
end;
// Write the modified contents back to the file
PkgConfigFile.SaveToFile(ExpandConstant('{app}\lib\pkgconfig\liblite-string.pc'));
finally
PkgConfigFile.Free;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
// Check if the installation is transitioning from ssPostInstall to ssDone
if (CurStep = ssDone) and (WizardForm.CurPageID = wpFinished) then
begin
// Save the installation path
AppPath := ExpandConstant('{app}');
// Perform actions after installation
ReplacePlaceholderInPkgConfig;
end;
end;