在Inno Setup中编译安装程序时,跳过不存在的源文件 [英] Skip non-existing source files when compiling installer in Inno Setup
本文介绍了在Inno Setup中编译安装程序时,跳过不存在的源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在[Files]
部分,我必须通过尝试编译不存在的文件来实现这一点,编译器不会失败并遵循其过程.
In the [Files]
section, I have to achieve that by trying to compiling a file that does not exist, the compiler does not fail and follow its course.
例如下面的代码:
[Files]
Source: "D:\{#pais}\{#modulo}\IMG\image.png"; \
DestDir: "{userdocs}\Qlik\Sense\Content\Default\{#senseAppDir}\IMG\"; \
Flags: ignoreversion
如果文件image.png
不存在,我希望编译器跳过它并继续.
If the file image.png
doesn't exists, I want the compiler to skip it and continue.
感谢您的时间!
推荐答案
有两个选项:
Source: "D:\{#pais}\{#modulo}\IMG\image.png"; \
DestDir: "{userdocs}\Qlik\Sense\Content\Default\{#senseAppDir}\IMG\"; \
Flags: ignoreversion skipifsourcedoesntexist
使用预处理程序指令#ifexist
:
Use preprocessor directive #ifexist
:
[Files]
#ifexist "D:\" + pais + "\" + modulo + "\IMG\image.png"
Source: "D:\{#pais}\{#modulo}\IMG\image.png"; \
DestDir: "{userdocs}\Qlik\Sense\Content\Default\{#senseAppDir}\IMG\"; \
Flags: ignoreversion
#endif
这篇关于在Inno Setup中编译安装程序时,跳过不存在的源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文