Inno Setup : Exclude a directory and its files also

别来无恙 提交于 2021-02-07 07:12:27

问题


I use the "Exclude" flag in Inno Setup in order to exclude from installation a subdirectory name "Bin32" or "Bin64" depending on the user's architecture.

All I want is to NOT install the useless folder and ALL its files and subdirectories as well.

Here are my current rules:

[Files]
Source: "Z:\Work\temp\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

; Exclude
Source: "*"; Excludes: "\Bin64"; DestDir: "{app}"; Flags: recursesubdirs; Check: not Is64BitInstallMode
Source: "*"; Excludes: "\Bin32"; DestDir: "{app}"; Flags: recursesubdirs; Check: Is64BitInstallMode

First, I don't quite understand what the "*" stands for at the beginning of the excluded rules ? Second, it works fine with all subdirectories inside Bin32/64 folder but the files are still been installed and I can't figure out a way to not install them...

Thx.


回答1:


Each entry is a single operation and is not effected by any other entry. With that in mind, this is what happens:

  1. The first line installs everying from z:\work\temp.
  2. The 2nd line, if in 32-bit mode, installs everything from SourceDir except \Bin64
  3. The 3rd line, if in 64-bit mode, installs everything from SourceDir except \Bin32

I expect that your SourceDir (the script path if not specified) is the same as Z:\Work\Temp and as such, you essentially end up with everything installed anyway.

If you duplicate the first entry, and move the Excludes (without the \ prefix) and Check parameters onto it, it should work as you require:

[Files]
Source: "Z:\Work\temp\*"; Excludes: "Bin64"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: not Is64BitInstallMode
Source: "Z:\Work\temp\*"; Excludes: "Bin32"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: Is64BitInstallMode


来源:https://stackoverflow.com/questions/10645269/inno-setup-exclude-a-directory-and-its-files-also

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