I am using the #include preprocessor directive to include other .iss files that contain separate components of my drivers installation.
[Files]
#include "subfolder\issComponent.iss"
and issComponent.iss performs an installation of a driver from its own relative path.
[Files]
Source: "Driver\Driver.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall
[Run]
Filename: "{tmp}\Driver.exe";
When I try to build the main/calling script, the relative path to Driver.exe do not work due to the relative pathing being referenced from the location of the main/calling script.
The path from the issComponent.iss resolves to
.\Driver\Driver.exe
instead of
.\subfolder\Driver\Driver.exe
since the include statement includes the file statements directly, and does not compile it from its own path. This is what is causing the error. I am wondering if there is a way to correctly use the relative paths in both locations.
The #include is interpreted by preprocessor. The [Files] (and other sections) are interpreted by compiler. Those are separate components which do not know about each other. Just like in C/C++. The preprocessor merges the issComponent.iss into the main .iss file like this:
[Files]
[Files]
Source: "Driver\Driver.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall
[Run]
Filename: "{tmp}\Driver.exe";
And the the compiler won't even know that the lines were originally in a different file, let alone in a different folder.
You can make use of some preprocessor capabilities to achieve what you want. For example the __PATHFILENAME__ predefined variable, which resolves to the path to the .iss file, where it is referenced.
#define PathToSelf ExtractFileDir(__PATHFILENAME__)
Source: "{#PathToSelf}\MyProg.exe"; DestDir: "{app}"
This will result in final .iss script like:
[Files]
[Files]
Source: "C:\full\path\to\subfolder\Driver\Driver.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall
[Run]
Filename: "{tmp}\Driver.exe";
Related
Is there a way to dynamically fill the [Dirs] and [Files] sections of an Inno Setup script?
Here is what I am trying to do:
during the install process, the user will select foo (foo matches a repository to get from our SCM)
Setup will run a batch to checkout foo from our SCM
then the content of foo must be added to the [Dirs] and [Files] sections of the script
Everything works fine except for the last step. I searched around and couldn't find explanations on how to do this. I have the feeling that my script should embed all the repositories of our SCM to then be able to copy only the selected ones to the destination directory.
Thanks for your help!
Regards,
See Inno Setup Prompt for external file location.
And add the recursesubdirs flag.
You may also need the createallsubdirs flag (assuming from your reference to the [Dirs] section).
[Files]
Source: "{code:GetScmPath}"; DestDir: "{app}"; \
Flags: external recursesubdirs createallsubdirs
[Code]
function GetScmPath(Param: string): string;
begin
Result := { make it return path to the checked out files }
end;
I have this line in .iss file:
Source: "..\Tcl\*"; DestDir: "{app}\Tcl"; Flags: ignoreversion
which packs folder Tcl. But it takes only files inside folder, but does not take subfolders inside Tcl. Is there a way to take entire folder Tcl with all subfolders and files? (without listing all that subfolders line by line).
Inno Setup 5.4.2.
Yes, there is. Simply include the recursesubdirs flag to your [Files] section entry. The help says about this flag the following:
Instructs the compiler or Setup to also search for the Source
filename/wildcard in subdirectories under the Source directory.
So, all you should do is modify your [Files] section entry this way:
[Files]
Source: "..\Tcl\*"; DestDir: "{app}\Tcl"; Flags: ignoreversion recursesubdirs
You can also use the Inno Wizard, but you'll need to correct the script afterwards if you would like those files to stay in the folder they're imported from, because the Wizard will put them in the app default folder.
The wizard wil generate:
[Files]
Source: "..\Tcl\*"; DestDir: "{app}; Flags: ignoreversion recursesubdirs
If you need to maintain the folder structure you'll need:
[Files]
Source: "..\Tcl\*"; DestDir: "{app}\Tcl"; Flags: ignoreversion recursesubdirs
Inno Wizard Update as of 5.6.1 (08/14/2018)
The Inno Setup Script Wizard now has the option to specify a subfolder. On the Application Files step of the wizard, use the Add Folder... button, then after you select the folder you would like to add, make sure it is selected in the list and then click Edit... and under the Destination Subfolder textbox, specify where you would like the previously selected folder contents to go.
I try to use the macros / variables in the following way, but then I get an error. Can you advice please?
#define AnnotateDir "C:\Users\new_skin\Annotate\project"
#define AnnotateUserInstallAppData "{userappdata}\Annotate3"
[Files]
Source: {AnnotateDir}\bin\gm_annotate.exe; DestDir: {app}; Flags: ignoreversion external
You are missing # char before the variable name which is used to emit defined variable value during script preprocessing stage. You can fix your script this way:
#define AnnotateDir "C:\Users\new_skin\Annotate\project"
[Files]
Source: {#AnnotateDir}\bin\gm_annotate.exe; DestDir: {app}; Flags: ignoreversion external
It looks quite misleading, but e.g. the {app} constant will remain after preprocessing whilst your defined variable will be replaced by its value, so that's why they have different notation in script.
I am programming my Inno Setup Compiler that I was asking about earlier but had encountered a problem . How do I let the Installer add a Read me File?? I am using Inno Setup Compiler 5.5.3 and uses the following command "AppReadmeFile=C:\Users\Cordre\Desktop\D_C Databasis Tools\Read me.txt" in Inno but if I install the program their is no Read Me file in the Program files.
The text document does exist and is called correctly double checked that.
Is their any other command that I also have to use?
From the documentation on AppReadmeFile:
This string, which may be a URL, is displayed on the "Support" dialog
of the Add/Remove Programs Control Panel applet in Windows 2000/XP and
later. The value may include constants.
This directive has nothing to do with a README file in the Program Files directory. If you want a copy of the README in the Program Files directory, you'd need to add it to the [Files] section. For example:
[Files]
Source: "MyReadme.txt"; DestDir: "{app}"; Flags: ignoreversion
You can also add an icon to the file using the [Icons] section. According to the documentation, a sample Icons entry would be:
Name: "{group}\My Program"; Filename: "{app}\MYPROG.EXE"; WorkingDir: "{app}"
I am trying to figure out how to rename a file in the file section while building the setup file.
I want to include a Local.config file but extract it as Local.config.tmp
I can't figure out why Inno Setup keeps creating folders instead of renaming files. So far I have this, but it keeps creating folders named Api\Local.config.tmp.
Any ideas?
[Files]
Source: "Api\Local.config"; DestDir: "{app}\Api\Local.config.tmp"; Flags: ignoreversion recursesubdirs
It's creating a folder as that's what you told it to do.
Try specifying a destination name:
[Files]
Source: "Api\Local.config"; DestDir: "{app}\Api\"; DestName: "Local.config.tmp"; Flags: ignoreversion recursesubdirs