inno-setup - Inno Setup - 通配符和特定 "Source"覆盖同一文件 - 哪个指令优先?

标签 inno-setup

假设我有:

[Files]
Source: *.*; DestDir: {app}; Flags: recursesubdirs
Source: address.txt; DestDir: {app}; Flags: onlyifdoesntexist

哪个优先并且行为已定义?我认为这两个覆盖的具体或最后列出取决于内部逻辑,但如果定义了他的行为,那就太好了。


如果它们都被执行(如答案所示),我将需要使用类似的东西:

[Files]
Source: *.*; DestDir: {app}; Flags: recursesubdirs; Excludes: "address.txt"
Source: address.txt; DestDir: {app}; Flags: onlyifdoesntexist

最佳答案

(几乎)没有什么特别的事情发生。

这两个规则都按照定义顺序进行处理,就像任何其他规则一样。

  • 首先,address.txt 由第一个掩码规则安装。

  • 然后处理第二个特定规则(但在这种特定情况下,由于 onlyifdoesntexist 标志,它不执行任何操作)。

2017-05-28 15:39:52.678   -- File entry --
2017-05-28 15:39:52.678   Dest filename: C:\Program Files\My Program\address.txt
2017-05-28 15:39:52.678   Time stamp of our file: 2017-05-28 15:39:20.000
2017-05-28 15:39:52.678   Installing the file.
2017-05-28 15:39:52.678   Successfully installed the file.
2017-05-28 15:39:52.678   -- File entry --
2017-05-28 15:39:52.678   Dest filename: C:\Program Files\My Program\address.txt
2017-05-28 15:39:52.678   Time stamp of our file: 2017-05-28 15:39:20.000
2017-05-28 15:39:52.678   Dest file exists.
2017-05-28 15:39:52.678   Skipping due to "onlyifdoesntexist" flag.

这两个规则发生的唯一特殊情况是,Inno Setup 识别出同一个文件 (address.txt) 被引用两次,因此它只将该文件存储到安装程序一次.

您将在编译器输出中仅看到 address.txt 的一条记录:

   Compressing: C:\source\address.txt

但是引用同一文件的任何规则(甚至两个特定规则)都会发生这种情况。所以这不是通配符与特定规则的问题。


当你 decompile the installer ,您将看到通配符规则实际上被编译器扩展为单独的规则。

所以你有效地得到了这个:

[Files]
Source: "???\address.txt"; DestDir: "{app}"; MinVersion: 0.0,5.0; 
Source: "???\address.txt"; DestDir: "{app}"; MinVersion: 0.0,5.0; Flags: onlyifdoesntexist 

关于inno-setup - Inno Setup - 通配符和特定 "Source"覆盖同一文件 - 哪个指令优先?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44227570/

相关文章:

batch-file - IF EXIST 对 C :\Windows\System32 in Windows batch (Inno Setup) 中文件的错误行为

inno-setup - Inno安装程序卸载程序: An attempt was made to access WizardForm before it has been created

inno-setup - 当未在 InputFilePage (CreateInputFilePage) 上选择文件时如何禁用 NextButton?

java - winrun4j 自动检测 JVM

inno-setup - Inno Setup 编译器中的最佳压缩设置

windows - 如何从 Batch 脚本上的 Exec 调用获取 ResultCode?

button - Inno Setup - 替换默认的下一个/返回/取消按钮

postgresql - 将 Inno Setup exec 函数中的命令传递到 pgsql 数据库中

external - 如何使用标志 : external? 从 [文件] 中的 CD-ROM 复制文件

inno-setup - Inno Setup 缩短文件路径字符串以适合 FilenameLabel