简体   繁体   English

如何在 Inno Setup 中使用通配符递归包含文件夹/文件

[英]How to recursivelly include folder/files using a wildcard in Inno Setup

I want to include language resource files from our build into our installers.我想将我们构建中的语言资源文件包含到我们的安装程序中。 The language resource files all have the same name, but reside in different sub-folders (one per locale), like this:语言资源文件都具有相同的名称,但驻留在不同的子文件夹中(每个区域设置一个),如下所示:

\Release
  \bin
    \es-MX
      Localization.resources.dll
    \fr-CA
      Localization.resources.dll
etc.

In my [Files] section, I thought perhaps I might be able to do this (note the position of the asterisk):在我的[Files]部分,我想也许我可以这样做(注意星号的位置):

Source: "..\\source\\Libraries\\Localization\\bin\\Release\\*\\Localization.resources.dll"; \
    DestDir: "{app}\\MyApp"; Flags: ignoreversion recursesubdirs

Unfortunately, Inno Setup blows up, complaining that it can't find any files:不幸的是,Inno Setup 崩溃了,抱怨找不到任何文件:

Compiler Error!编译错误!
Line 129: No files found matching "C:\\Development\\HT\\Installers\\..\\source\\Libraries\\Localization\\bin\\Release\\*\\Localization.resources.dll"第 129 行:找不到与“C:\\Development\\HT\\Installers\\..\\source\\Libraries\\Localization\\bin\\Release\\*\\Localization.resources.dll”匹配的文件

I would like Inno Setup to look for any sub-folder (hence the * ) containing a file named Localization.resources.dll and upon installation, create a language directory with the same name (based on what is found via the wildcard) and copy the file to that folder, doing so for each folder that matches the criteria.我希望 Inno Setup 查找包含名为Localization.resources.dll的文件的任何子文件夹(因此是* ),并在安装时创建一个具有相同名称的语言目录(基于通过通配符找到的内容)并复制将文件复制到该文件夹​​,对符合条件的每个文件夹执行此操作。

Essentially, I want to end up with this:本质上,我想以这样的方式结束:

..
  \MyApp
    \es-MX
      Localization.resources.dll
    \fr-CA
      Localization.resources.dll

In case it isn't obvious, I would prefer not to explicitly add the source and destination folder names, because we will be adding more languages/locales in the future, and I would like Inno Setup to automatically pick up any new language folders/files we create without having to change the installer source.如果不明显,我不想显式添加源和目标文件夹名称,因为我们将来会添加更多语言/区域设置,并且我希望 Inno Setup 自动选择任何新的语言文件夹/我们创建的文件而无需更改安装程序源。

Is this possible?这可能吗?

Just use the recursesubdirs flag with a root path to a tree and the Localization.resources.dll filename.只需将recursesubdirs标志与树的根路径和Localization.resources.dll文件名一起使用。 It will automatically do what you want: find all Localization.resources.dll files in the tree and install them to their respective subfolders:它会自动执行您想要的操作:在树中找到所有Localization.resources.dll文件并将它们安装到各自的子文件夹中:

Source: "..\source\Libraries\Localization\bin\Release\Localization.resources.dll"; \
    DestDir: "{app}\MyApp"; Flags: ignoreversion recursesubdirs

As documented (emphasis mine):正如所记录的(强调我的):

recursesubdirs递归子目录

Instructs the compiler or Setup to also search for the Source filename /wildcard in subdirectories under the Source directory.指示编译器或安装程序也在Source目录下的子目录中搜索Source 文件名/wildcard。


Other possible approaches:其他可能的方法:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM