I created a ISS file for Inno Setup to install a software and I have a YAML configuration file where I need to change a value in it during the installation.
I am new of Inno Setup and I don't have experience in Pascal, so I looked around and found how to open and change a text file or a JSON but not YAML, I don't know if it's the same.
My ISS file is:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "MyApp"
#define MyAppVersion "1.0"
#define MyAppPublisher "Myself"
#define MyAppExeName "MyApp.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{5FA0A2CF-7FD4-4464-AF88-4B73D0857D03}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName=C:\ProgramData\MyApp\{#MyAppName}
DisableDirPage=no
DefaultGroupName=MyApp
;DisableProgramGroupPage=yes
OutputDir=D:\MyApp
OutputBaseFilename=MyApp
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "D:\MyApp\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\MyApp\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Code]
procedure Update;
var
C: AnsiString;
CU: String;
begin
LoadStringFromFile(ExpandConstant('conf.yml'), C);
CU := C;
StringChangeEx(CU, 'logoImage:', '{app}\ImageLogos.svg', True);
C := CU;
SaveStringToFile(ExpandConstant('conf.yml'), C, False);
end;
function InitializeSetup: Boolean;
begin
Update;
result := True;
end;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}""
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent"
A subset of my configuration file (conf.yml) is like this:
graphs:
Temperature:
plots:
Temperature pcolor:
cmap: nipy_spectral
type: contourf
var: thetao
min: 10.0
max: 35.0
units: Celsius
Salinity:
plots:
Salinity pcolor:
type: contourf
var: so
min: 25.0
max: 50.0
units: Practical Salinity Unit
logoImage: 'D:\MyApp\ImageLogos.svg'
appTitle: 'MyApp'
What I want is to change the path of logoImage with the path of the installed app.
If I use my script, I can compile and install my software but it doesn't change the configuration file.
All the examples I found are with JSON and they use third-party libraries.
Do you have any suggestions?