When I define a preprocessor string variable (using the ISPP) that contains a quote/apostrophe, there will be a compiler error when I use the function ExpandConstant
in the [Code]
section to read this string.
Here's an example .iss
script for demonstrating/testing:
#define _AppName "Uli's Program"
[Setup]
AppName={#_AppName}
AppVersion=1.2.3
DefaultDirName={pf}\{#_AppName}
[Code]
function InitializeSetup: Boolean;
begin
MsgBox(ExpandConstant('{#_AppName}'),
mbInformation,
MB_OK);
Result:=False;
end;
The exact compiler error message is:
comma (',') expected.
Update
This works when the apostrophe is doubled. But now the captions of the wizard pages show the app name with a double apostrophe (because of AppName={#_AppName}
).
A similar issue occurs when the #define
is removed and the script is altered this way:
[Setup]
AppName=Uli's Program
AppVersion=1.2.3
DefaultDirName={pf}\{#AppName}
[Code]
function InitializeSetup: Boolean;
begin
MsgBox('{#SetupSetting("AppName")}'),
mbInformation,
MB_OK);
Result:=False;
end;
Now the compiler error message is
Assignment expected.