I am working on compiling an Inno Setup project. What I am trying to do is check if a folder exists, and if the folder does not exist then I want to uncheck a checkbox in the [run]
section.
I was trying to accomplish this through the [Code]
section. However, I cannot figure out how to call the function in the flags of my [Run]
section.
In my code section, I have the following function that checks to see if the directory exists, if it does not then I attempt to set the flag to be unchecked if the directory does exist I just return any flag.
[Code]
function VerifyDir(DirName: String): Flag;
begin
{Check if directory exists, if it does then set the check flag to unchecked}
if not DirExists(DirName) then
Result := unchecked
end;
{Directory Exists return a flag}
Result := nowait
end;
Then in my [Run]
section, I attempt to pass back the flag from the function like so:
[Run]
Filename: C:\3S\LegacyAppFolder\Update.exe; Description: Blah Blah Blah; \
Flags: VerifyDir('C:\3S\LegacyAppFolder')
However, I get an error when I try to compile the installer
Parameter "Flags" includes an unknown flag.
I assume this is because either I cannot have an inline function and I need to go about this a different way, or this is not possible at all.
You don’t want to use the flags
section to do the test.
If you look here you will see that the right thing to do is use:
Check: xxxxxxx
If the check function returns true the statement is processed.