1

I have the following [Files] entry:

Source: "CutToolsBcad.dll.config"; 
    DestDir: "{app}"; 
    Flags: ignoreversion; 
    Check: IsAvailable('BRX', '21', 'x64');   
    AfterInstall: SetupDemandload('BRX', '21', 'x64')

This file is a standard XML file and my installer does not use admin elevation.

In the config file it has (rest of data snipped):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <userSettings>
        <CutTools.Properties.Settings>
            <setting name="SaveToDXF_OutputFolder" serializeAs="String">
                <value />
            </setting>
        </CutTools.Properties.Settings>
    </userSettings>
</configuration>

I would like the installer to update this file (for new installs) with the {app} folder value.


At the moment I am creating a [Registry] entry:

Root: "HKCU"; 
    Subkey: "Software\{#MyAppPublisherKey}\{#MyAppBaseName}";
    ValueType: string; 
    ValueName: "InstallPath"; 
    ValueData: "{app}"; 
    Flags: uninsdeletekeyifempty uninsdeletevalue; 
    Check: not IsAdmin()

And then in my application I do the following:

textBoxSavePath.Text = Properties.Settings.Default.SaveToDXF_OutputFolder;
if(textBoxSavePath.Text == String.Empty)
{
    textBoxSavePath.Text = (string)Registry.CurrentUser.GetValue("Software\\TruckleSoft\\CutToolsBcad.dll\\InstallPath");
}

But if there is a fairly simple way to directly update the config file directly using Inno Setup I would liek to know.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • @MartinPrikryl I now realise I can’t tweak the file for new install only since this is a new feature for existing installs. So after the install we need to open the file and update the value to app if current value is empty. Either that or do the tweak only if the file is actually installed (make sense?). – Andrew Truckle Sep 16 '21 at 10:20
  • @MartinPrikryl I have decided to keep it simple and let the DLL itself determine the default. Thanks for the links though. – Andrew Truckle Sep 16 '21 at 19:24

0 Answers0