Skip non-existing source files when compiling inst

2019-05-23 07:38发布

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.

For example in this code:

[Files]
Source: "D:\{#pais}\{#modulo}\IMG\image.png"; \
    DestDir: "{userdocs}\Qlik\Sense\Content\Default\{#senseAppDir}\IMG\"; \
    Flags: ignoreversion  

If the file image.png doesn't exists, I want the compiler to skip it and continue.

Thanks for your time!

标签: inno-setup
1条回答
老娘就宠你
2楼-- · 2019-05-23 08:11

There are two options:

  1. Use skipifsourcedoesntexist flag:

    Source: "D:\{#pais}\{#modulo}\IMG\image.png"; \
        DestDir: "{userdocs}\Qlik\Sense\Content\Default\{#senseAppDir}\IMG\"; \
        Flags: ignoreversion skipifsourcedoesntexist
    
  2. 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
    
查看更多
登录 后发表回答