Search code examples
installationinno-setup

On selection of C:\CustomFolder install path, the install path should be subfolder C:\CustomFolder\Parent\Child


When the user Changes the installation folder, for example to C:\CustomFolder, my Inno Setup based installer should use the following subfolder for installation instead: C:\CustomFolder\Parent\Child.

What I found so far is that there is the AppendDefaultDirName option, which appends the last component of DefaultDirName to the selected folder name. But this isn't the behaviour I need.


Solution

  • A simple solution is to use {app}\Parent\Child everywhere in the script, instead of plain {app}.

    #define TheAppPath "{app}\Parent\Child"
    
    [Setup]
    UninstallFilesDir={#TheAppPath}
    
    [Files]
    Source: "MyProg.exe"; DestDir: "{#TheAppPath}"
    Source: "MyProg.dat"; DestDir: "{#TheAppPath}"