gpt4 book ai didi

inno-setup - 有条件地在 Inno Setup 中包含文件夹

转载 作者:行者123 更新时间:2023-12-05 04:00:51 24 4
gpt4 key购买 nike

我正在尝试使用 Inno Setup 创建一个安装程序,它将静态包含一个文件夹(如果存在)。如果用户系统上已存在特定目录,则此文件夹将安装在用户系统上。

例如,有特定于 2017、2018、2019 的配置。如果我有 CC2017 文件夹,则将其包含在安装程序中。如果存在,安装程序会将用户系统上的文件夹放在他们的 2017 文件夹中。

我使用变量来定义一些路径,并根据 the answer here 将它们格式化为不带括号的格式.

#ifexist projpath + "\" + reponame + "\Plug-Ins\Windows\CC2017\"  
Source: "{#projpath}\{#reponame}\Plug-Ins\Windows\CC2017\{#pluginname}\*"; \
DestDir: "{sd}\Program Files\Adobe\Adobe InDesign CC 2017\Plug-Ins\{#pluginname}"; \
Flags: ignoreversion recursesubdirs createallsubdirs replacesameversion; \
Check: MyDirCheck(ExpandConstant('{sd}\Program Files\Adobe\Adobe InDesign CC 2017'))
#endif

我知道它没有正确检查,因为当我添加 ifexist 指令时文件大小要小得多。 Inno Setup docs提到"file"而不是文件夹,所以我怀疑它可能不支持检查文件夹。

语法有什么问题?

我在 Mac 10.13.6 上使用 Inno Setup 6.0.2

最佳答案

有两种选择:

  1. 使用 skipifsourcedoesntexist flag :

    [Files]
    Source: "folder\*"; DestDir: "{app}"; Flags: skipifsourcedoesntexist
  2. 使用 #if preprocessor directive连同 DirExists preprocessor function :

    [Files]
    #if DirExists("folder")
    Source: "folder\*"; DestDir: "{app}"
    #endif

关于inno-setup - 有条件地在 Inno Setup 中包含文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55928180/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com