Inno Setup - #define directive - how to use previously defined variable?

15,493
#define MyAppSetupDir "D:\MyApp\setup"
#define MyAppSetupQtDLLs MyAppSetupDir + "\DLLs"
Share:
15,493

Related videos on Youtube

LittleFish
Author by

LittleFish

Updated on June 04, 2022

Comments

  • LittleFish
    LittleFish almost 2 years

    I am using Inno Setup version 5.4.2.

    I want to define the path for the files to copy (the Source: parameter in the [Files] section as two parts, a base path and sub-directory names, that I use for special files (like .dlls). I have tried the following:

    #define MyAppSetupDir "D:\MyApp\setup"
    #define MyAppSetupQtDLLs {#MyAppSetupDir}"\DLLs"
    [Files]
    Source: {#MyAppSetupDir}\MyApp.exe; DestDir: {app}; Flags: ignoreversion
    Source: {#MyAppSetupDLLs}\mstext35.dll; DestDir: {app}; Flags: ignoreversion
    

    but I get the following compilation error

    [ISPP] Expression expected but opening brace ("{") found.
    

    I also tried to enclose the braces in "", like

    #define MyAppSetupQtDLLs "{#MyAppSetupDir}\DLLs"
    

    But this time I got

    Error: Source file "D:\MyApp\setup\{#MyAppSetupDir}\DLLs\mstext35.dll" does not exist.
    

    So, ISSP is correctly replacing the MyAppSetupDir variable, but then puts again the simple text, as if it did not recognize the directive.

    I have searched everywhere, and I already found a discussion about using the {commonappdata}, but I could not find how to do this, neither in the documentation nor in the KB. I would really appreciate some hints, as it looks I am close, but not finding the right solution..