Inno setup Inno设置中的#emit指令有什么意义?
以下是来自以下方面的示例: 在第一行中,我不理解Inno setup Inno设置中的#emit指令有什么意义?,inno-setup,directive,preprocessor,Inno Setup,Directive,Preprocessor,以下是来自以下方面的示例: 在第一行中,我不理解DestDir部分。看起来那里缺少#符号 我理解第二行。但是为什么我们需要像第1行那样使用#emit指令呢?可以使用两个语法调用 基本语法: #directive params 和内联语法: {#directive params} 最重要的是,当未指定显式指令名时,默认的内联指令为 所以这三个是等价的: #emit MyDestDir Source: "file2.ext"; DestDir: "{app}&
DestDir
部分。看起来那里缺少#
符号
我理解第二行。但是为什么我们需要像第1行那样使用#emit
指令呢?可以使用两个语法调用
基本语法:
#directive params
和内联语法:
{#directive params}
最重要的是,当未指定显式指令名时,默认的内联指令为
所以这三个是等价的:
#emit MyDestDir
Source: "file2.ext"; DestDir: "{app}"
#emit 'Source: "file1.ext"; DestDir: {' + MyDestDir + '}'
虽然第一个变量对于path变量没有意义,因为它会导致无效的脚本语法,但它可以与包含有效脚本语法的变量一起使用:
#define FileSectionEntry 'Source: ' + MySource + '; DestDir: ' + MyDestDir
#emit FileSectionEntry
虽然其他两个内联示例可能有意义,但仅适用于同一行中的其他代码,如您问题中的代码:
Source: "file2.ext"; DestDir: {#MyDestDir}
此外,带有(字符串)常量的
#emit
基本上是没有意义的,因为不需要预处理器也可以实现同样的效果
这三者相当:
#emit MyDestDir
Source: "file2.ext"; DestDir: "{app}"
#emit 'Source: "file1.ext"; DestDir: {' + MyDestDir + '}'
因此,回到脚本中的代码,它们(几乎)是等价的:
#emit MyDestDir
Source: "file2.ext"; DestDir: "{app}"
#emit 'Source: "file1.ext"; DestDir: {' + MyDestDir + '}'
唯一的问题是,我认为第一行中的花括号不应该在那里。线路应为:
#emit 'Source: "file1.ext"; DestDir: ' + MyDestDir
我已经提交了一份报告。这基本上是你上一个问题中打字错误的另一个副本: