Why preprocessor behaves differently in #include directive then in [Files] section Inno Setup script

北城以北 提交于 2019-12-01 12:05:05

Within # you are in the "realm" of Inno Setup preprocessor.

There are two ways to enter preprocessor realm.

  • Full line syntax:

    #directive args
    
  • And inline syntax:

    {#directive args}
    

    The inline syntax is almost exclusively used for emit directive - {#emit <expression>}. And for this reason there's a shorthand format, with the emit omitted: {#<expression>}.

The inline syntax is useful when you want to use preprocessor expression outside of preprocessor realm. Like in normal Inno Setup sections (or in Pascal Script code):

[Files]
Source: "{#FindFolder("..\packages\PackagesA*")}\*.*"; DestDir: "{app}"; \
    flags: recursesubdirs  

Though in #include preprocessor directive, you are already in the preprocessor realm. And there, the {#xxx} syntax is invalid (it might even have a different [valid] meaning theoretically, but actually curly brackets have no use in preprocessor).

The syntax of #include directive is:

#include <expression>

The preprocessor uses C-like expression syntax. So your expression in this case is:

FindFolder('..\..\..\packages\ScriptPreRequisites*') + '\DotNetDependencies.iss'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!