Inno Setup : Exclude a directory and its files also - inno-setup

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.

Each entry is a single operation and is not effected by any other entry. With that in mind, this is what happens:
The first line installs everying from z:\work\temp.
The 2nd line, if in 32-bit mode, installs everything from SourceDir except \Bin64
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

Related

File not being unregistered by Inno Setup during uninstall when it is also matched by a wildcard Files section entry

I currently use the following code to install and register a DLL.
[Files]
Source: "Keys\Sentinel\*"; DestDir: "{app}"; Flags: recursesubdirs 32bit
Source: "Keys\Sentinel\hasp_com_windows.dll"; DestDir: "{app}"; \
Flags: regserver 32bit noregerror;
This works great during an install operation, and the logfile shows that the file has been successfully registered. My problem is that during an uninstall the file is not being unregistered, and the uninstall logfile contains nothing about the file other than that it has been deleted, which it has. What could cause the file to not be unregistered? The help file says it should be.
I can confirm the behavior you are seeing.
In general you should never install the same file to the same destination using two distinct entries in the [Files] section. That always leads to an unexpected behaviour. Like in this case.
The right solution is to exclude the DLL from the wildcard entry:
[Files]
Source: "Keys\Sentinel*"; DestDir: "{app}"; Excludes: "hasp_com_windows.dll"; \
Flags: recursesubdirs 32bit
Source: "Keys\Sentinel\hasp_com_windows.dll"; DestDir: "{app}"; \
Flags: regserver 32bit noregerror

Inno setup throws error "No Files Found Matching" Even tough files are there

I am observing very weird behavior with inno setup whilst compiling the script.
I have following code in the script
[Files]
Source: "Deploy\x86\AppFiles*"; DestDir: "{app}"; Check: not IsX64; \
Flags: ignoreversion recursesubdirs
Source: "Deploy\x64\AppFiles64*"; DestDir: "{app}"; Check: IsX64; \
Flags: ignoreversion recursesubdirs
Even Though there are files in folder and folder location is also correct , I keep on getting error
"No Files Found Matching"
Not sure what is causing it ?
I assume that AppFiles and AppFiles64 are folders, so you need this:
[Files]
Source: "Deploy\x86\AppFiles\*"; ...
Source: "Deploy\x64\AppFiles64\*"; ...
(Note the slash before *).

Two or more functions are not working when they are used in a Check parameter

I have been trying to make work two functions in a Check. When I use more than one function none of them work. For example:
[Files]
Source: MyProg.exe; DestDir: "{app}"; Flags: ignoreversion; Check: portable and install;
Source: MyProg.dll; DestDir: "{app}"; Flags: ignoreversion; Check: portable and install;
Source: MyProg.ini; DestDir: "{app}"; Flags: ignoreversion; Check: portable and install;
When i only use one check portable or install, it works although i know that i can repeat the source Dir and place the other check like this:
[Files]
Source: MyProg.exe; DestDir: "{app}"; Flags: ignoreversion; Check: portable;
Source: MyProg.dll; DestDir: "{app}"; Flags: ignoreversion; Check: portable;
Source: MyProg.ini; DestDir: "{app}"; Flags: ignoreversion; Check: portable;
Source: MyProg.exe; DestDir: "{app}"; Flags: ignoreversion; Check: install;
Source: MyProg.dll; DestDir: "{app}"; Flags: ignoreversion; Check: install;
Source: MyProg.ini; DestDir: "{app}"; Flags: ignoreversion; Check: install;
But as I have many files, I want to use more than one function in one Check for not to be copying and pasting too many sources lines in the [Files] section.
This:
[Files]
Source: MyProg.exe; DestDir: {app}; Check: portable and install
is not identical to:
[Files]
Source: MyProg.exe; DestDir: {app}; Check: install
Source: MyProg.exe; DestDir: {app}; Check: portable
The first says install the file, when both portable and install are true/selected. What probably never happens.
While the latter says install the file, when either portable or install are true/selected.
So, you want to use or operator instead of and:
[Files]
Source: MyProg.exe; DestDir: {app}; Check: portable or install

Inno-setup pack all files in a folder exept for 1 file

I want to pack all files in a folder like so:
Source: "...Src\*";DestDir:"{app}";Flags: ignoreversion recursesubdirs createallsubdirs
But I want it to pack all files inside Src except for 1 file.
Hopefully there is some code to exempt a file from being packed.
To specify the file you want to exclude from your setup archive source use the Excludes parameter:
[Files]
Source: "Src\*"; Excludes: "Src\SubFolder\FileToExclude.exe"; DestDir:"{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

How to reference file from external folder so that it's still included in the installer package?

Here's what I'm trying to do:
Source: {%QTDIR}/bin/QtCore4.dll; DestDir: {app}; Flags: ignoreversion;
It doesn't unfold the QTDIR environment variable and gives me an error. It compiles and works fine if I add external flag, but I do need the file to be compiled into the installer package. Any way to achieve this?
Perhaps you could use ISPP #define?
Example:
#define MYCONSTANT GetEnv("USERPROFILE")
[Files]
Source: "{#MYCONSTANT}\myfile.txt"; DestDir: {app}; Flags: ignoreversion
I'm linking to UserProfile here as an example, but you can define QTDIR there if it is set as system constant %QTDIR%.
Probably:
#define QTDIRCONSTANT GetEnv("QTDIR")
[Files]
Source: "{#QTDIRCONSTANT}\bin\QtCore4.dll"; DestDir: {app}; Flags: ignoreversion

Resources