在Inno Setup预处理器中发出新行 [英] Emit new line in Inno Setup preprocessor
问题描述
在使用 Inno Setup预处理器来生成多行输出时,例如在以下答案中我的:
When using Inno Setup preprocessor to generate a multi-line output, like for example in these answers of mine:
- Inno设置-递归子目录而不创建相同的子目录
- 向Inno File部分添加多个源代码行的功能
- 以编程方式生成Inno Setup文件标志
- Inno设置:为文件夹及其子文件夹中的所有文件动态添加组件
- 在所有文件的源路径之间进行选择
- Inno Setup - Recurse sub directories without creating those same sub directories
- Function to add multiple source lines to Inno File section
- Generating Inno Setup file flags programmatically
- Inno Setup: Dynamically add a component for all files in a folder and its subfolders
- Choose between source paths for all files
我总是必须使用 #pragma parseroption
指令切换到C样式的字符串文字,因为有了C样式的字符串文字,我可以使用\n
:
I always have to switch to the C-style string literals using #pragma parseroption
directive, because with C-style string literals, I can use \n
:
#pragma parseroption -p-
#define TwoLines "line1\nline2\n"
#pragma parseroption -p+
在默认的Pascal样式字符串文字中,我还没有找到任何方法来产生换行符.
I haven't found any way to emit a new-line character in the default Pascal-style string literals.
在真实的Pascal(脚本)字符串中,可以使用#13#10
.但这在预处理器中不起作用. Pascal都没有等效的 Chr
函数.
In a real Pascal (Script) string, one can use #13#10
. But that does not work in the preprocessor. Neither there's an equivalent of Pascal Chr
function.
还有其他方法可以在Pascal样式的字符串文字中生成新行吗?
Is there any other way to emit a new line in the Pascal-style string literals?
推荐答案
有
There's NewLine
macro available in Inno Setup 6.
如果您使用的是Inno Setup的旧版本,则可以在自己的脚本中定义宏.定义为:
If you are on an older version of Inno Setup, you can define the macro in your own script. It's defined as:
#pragma parseroption -p-
#define NewLine "\n"
#pragma parseroption -p+
这篇关于在Inno Setup预处理器中发出新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!