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
Related
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";
I have a application in beta testing phase. It has application files, and a database (.db) file, which I would like to keep and not replace.
Lets assume I provided a version 1.0 to my clients, and they installed it. Now I have version 1.1 that has some changes in the application files, but not in the db.
How can I instruct Inno Setup to preserve that one file, and for the rest of them just replace?
[Files]
Source: "D:\nw\testfile.db"; DestDir: "{app}"; Flags: uninsneveruninstall onlyifdoesntexist
Source: "D:\nw\*"; Excludes: "\node_modules\"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs;
With this script file, the testfile.db is always overwritten with the new version.
My goal is to preserve the testfile.db during the new installation.
2016-06-06 13:36:21.630 -- File entry --
2016-06-06 13:36:21.630 Dest filename: C:\Complexity tool\testfile.txt
2016-06-06 13:36:21.631 Time stamp of our file: 2016-06-06 09:41:08.000
2016-06-06 13:36:21.631 Dest file exists.
2016-06-06 13:36:21.631 Time stamp of existing file: 2016-06-06 09:41:08.000
2016-06-06 13:36:21.631 Version of our file: (none)
2016-06-06 13:36:21.631 Version of existing file: (none)
2016-06-06 13:36:21.631 Installing the file.
2016-06-06 13:36:21.632 Successfully installed the file.
Thank you
The problem is that while the file is probably not installed by the first entry D:\nw\testfile.db, it is installed by the second wildcard entry D:\nw\*.
You have to add onlyifdoesntexist even to the wildcard entry. Or if you need to overwrite all the other files, even if they exist, explicitly exclude the testfile.db file from the wildcard entry:
Source: "D:\nw\testfile.db"; DestDir: "{app}"; Flags: uninsneveruninstall onlyifdoesntexist
Source: "D:\nw\*"; Excludes: "\node_modules\,\testfile.db"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs
I have a simple app that copies some folders and files in C:/ directory with attribute READ ONLY. I did it well. But my problem is when I try to uninstall the previous version and install the new version, this folder did not remove because attribute is set read only. What i want to do is
1-when user install the app I want inno setup check if the app already installed or not
2-uninstall the previous first and then install the new version.
I must set attribute read only for this folders and files.
[Files]
Source: "D:\POS CAD Standard\acad.lsp"; DestDir: "{userappdata}\Autodesk\AutoCAD 2014\R19.1\enu\support";
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; Flags:recursesubdirs createallsubdirs; Attribs: readonly hidden system;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[dirs]
Name: "{sd}\POS CAD Standard";Attribs: readonly hidden system;
[Icons]
Name: "{group}\{cm:UninstallProgram,ALstom POS CAD Standard}";Filename: "{uninstallexe}"
Use uninsremovereadonly flag.
And as you have found yourself already, use also overwritereadonly flag to allow upgrade.
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; \
Flags: recursesubdirs createallsubdirs uninsremovereadonly overwritereadonly; \
Attribs: readonly hidden system;
I am creating an installer using Inno Setup and I have a file whose name changes every release (because the file name has the version number embedded in it):
#define MY_FILE_NAME "file_1.0.0.jar"
[Files]
Source: {#MY_FILE_NAME}; DestDir: {app}; Flags: ignoreversion
How would I make my installer remove file_1.0.0.jar from the install location when installing file_2.0.0.jar?
I added an [InstallDelete] section which seems to do the trick:
[InstallDelete]
Type: files; Name: "{app}\file_*.jar"
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.