Search code examples
inno-setuppascalscript

Using scripting constant in DirExistsWarning and other directives


I'm trying to script the Constant DirExistsWarning but it returns an error:

Value of [Setup] section directive "DirExistsWarning" is invalid.

My simplified script is as such:

...
[Setup]
DirExistsWarning={code:showFolderExists}
...
[Code]
{ hide folder exists Dialog when this version is being uninstalled }
function showFolderExists(Param: String): String;
begin
    Result := 'yes';
end;

Can this constant not be scripted? If so, is there an accessible list of constants that can be or cannot be scripted? I also tried returning a boolean value without much success.

Thank you


Solution

  • Yes, DirExistsWarning directive cannot be scripted, because its value cannot include "constants" (sic).

    Directives that can include "constants" (what includes "scripted constants") have that explicitly mentioned in their documentation.

    For example the documentation for AppId directive says:

    The value may include constants.


    For your actual problem see Inno Setup, install only on a non existent directory.