Inno Setup:是否可以从“设置”部分生成用户定义的“信息/警告”消息?

时间:2018-09-27 10:12:28

标签: inno-setup

只有在编译安装程序时指定路径中存在“自述文件”时,我才有以下代码显示InfoBeforeFile页面。

此外,我还希望在编译时不存在“自述文件”时显示信息/警告消息。

#define readmeFile 'readme.rt'
[Setup]
#if FileExists(readmeFile)
InfoBeforeFile=notes.rtf
#else
;Is it possible to generate info message on Inno setup console when file does not exist ?
#endif

欢迎使用Inno Setup的其他任何部分从“设置”部分显示信息消息的任何可能方式。

1 个答案:

答案 0 :(得分:1)

您可以使用#pragma warning preprocessor directive

#define readmeFile 'readme.rt'
[Setup]
#if FileExists(readmeFile)
InfoBeforeFile=notes.rtf
#else
#pragma warning "Readme does not exist"
#endif

编译安装程序时,您将获得以下输出:

  

[ISPP]预处理。
  [ISPP警告](6):自述文件不存在。
  [ISPP]已预处理。


还有#pragma message


为清楚起见:这与Setup部分无关。所有带有#的行都是preprocessor伪指令(如C / C ++中的伪指令),甚至在Inno Setup编译器解析节之前都会对其进行处理。

当自述文件不存在时,Inno Setup编译器将仅显示:

[Setup]

当自述文件确实存在时,Inno Setup编译器将看到:

[Setup]
InfoBeforeFile=notes.rtf