inno-setup

Set default icon when specified path does not exist


I have a Inno Setup script with different #define that I enable individually in order to compile setups for different clients.

In the [Setup] section I set the WizardImageFile property as

WizardImageFile={#CustomClientResourceFolder}\logo.bmp

Now, the problem is that I do not have this "logo.bmp" for every client, and I wish not to create fake "logo.bmp" with default images. But if I compile the code above without the image, the compiler throws a "Missing file" error.

So: How could I tell Inno Setup something like "use this logo.bmp and if you don't find it use your default setup icons"?


Solution

  • Conditionally use the WizardImageFile directive, only if the file exists. Use #ifexist preprocessor directive:

    #define LogoPath CustomClientResourceFolder + "\logo.bmp"
    
    #ifexist LogoPath
    WizardImageFile={#LogoPath}
    #endif