Inno Setup automatic deletion of read only folder on uninstall - inno-setup

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;

Related

How to override a third-party installation directory with inno setup

I need to install a thirdparty software embedded in a installer named thirdparty-installer.exe and also install my application Instruct.exe. My application will be at c:\MyAPP folder and all my thirdparty files must be at c:\windows\system32 (all files will be thrown there, in the system32 root). I have done the following:
#define OutputDirectory_MPP "c:\myAPP"
[setup]
DefaultDirName=c:\MyAPP
DisableDirPage=yes
[dirs]
Name: {#OutputDirectory_MPP}; Attribs: system
[files]
Source: "g:\application\Instruct.exe"; DestDir: {#OutputDirectory_MPP}
Source: "g:\applicationr\thirdparty-installer.exe"; DestDir: "{cf}"; Flags: ignoreversion recursesubdirs createallsubdirs promptifolder; Permissions: system-full;
[Run]
Filename: "{cf}\thirdparty-installer.exe"; Flags: shellexec waituntilterminated
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
(...)
My Instruct.exe installs normally, and when it finishes, the thirdparty-installer prompts and show the user the option to change installation directory. Their default is c:\program files\Thirdparty2020\
How can I impose their installation to be on the c:\windows\system32 folder and leave no option to the user? (possibly even coupled with a silent install).

Inno Setup - Preserve a single existing file, but install all other in a directory tree

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

Error running .exe file in Inno setup

I am trying to make my script run this file:
http://www.microsoft.com/en-us/download/details.aspx?id=40779
before/after (doesn't matter) I install my application.
This is my script:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; Flags: skipifsilent
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{AEDD3A70-5044-452B-B78D-9CCE4E130654}
AppName=Pong
AppVersion=2.0
;AppVerName=Pong 2.0
AppPublisher=Roymunson_Studios
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
DefaultDirName={pf}\Pong
DefaultGroupName=Pong
AllowNoIcons=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Run]
Filename: "{app}\Installers\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"; StatusMsg: "Installing .NET Framework 4.5.1"
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "C:\Users\vroy\Desktop\Debug\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{commondesktop}\Pong"; Filename: "{app}\Pong.exe";
However when it tries to compile the .NET 4.5.1 installer file it shows the following error:
"The process cannot access the file because it is being used by another process"
This makes no sense because the .NET 4.5.1 installer is not being used when I am compiling my Inno script.

Replacing a file whose file name changes every release with Inno Setup

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"

Inno Setup Rename File during packing

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

Resources