2

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

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Markus Heckmann
  • 307
  • 1
  • 6
  • Correct. This directive is for compilation time and cannot be scripted by code (at this time). – TLama Dec 03 '19 at 19:03
  • Thanks @TLama, can I ask if there is any way to control this behavior on ```wpSelectDir```? I guess otherwise I'll implement a manual MsgBox in ```NextButtonClick()```. – Markus Heckmann Dec 03 '19 at 21:17
  • For that, see [Inno Setup, install only on a non existent directory](https://stackoverflow.com/q/55721409/850848). – Martin Prikryl Dec 03 '19 at 21:22

1 Answers1

1

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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992