4
votes

I have an Inno Setup script which looks for a file as a preprocessor step:

#define a_path GetEnv("INSTALLER_FILES")
#define install_file FindFirst(a_path + "\pattern*.*")

When the install_file is not found, I would like to emit an error:

#if install_file == 0
    #error No installer found at {#a_path}
#endif

But the ISPP only writes the literal source line on compilation:

script.iss: [ISPP] No installer found at {#a_path}

Is it possible to expand a preprocessor variable in the #error directive?

1

1 Answers

5
votes

The argument of the #error directive cannot contain variables.

But you can use the #pragma error directive instead:

#pragma error "No installer found at " + a_path