Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename an existing file before replacing it in an Inno setup

Tags:

inno-setup

I've got the following script...

[Files]
Source: "extractor.prop"; DestDir: "{app}"

How can I say, if extractor.prop already exists, rename it to extractor.prop.old and install this one? By default at the moment it just deletes the old file so I don't want to erase the file if it's currently in use on a customer's site.

like image 247
david99world Avatar asked Nov 17 '11 17:11

david99world


People also ask

What is an Inno Setup file?

Inno Setup is a free software script-driven installation system created in Delphi by Jordan Russell. The first version was released in 1997.

How do I make an inno file executable?

Go to Menu, Project, then Compile to compile and create the setup file. This will create a complete installer. Run the Setup and your application will be installed correctly. Innosetup offers an awesome alternative to create great looking Installers for free.

What language does Inno Setup use?

Inno Setup's [Code] section uses Pascal (or Pascal Script to be more exact, thanks to TLama), likely because Inno Setup itself is written in Pascal Delphi.

How do I add a checkbox in Inno?

You don't have to manually create checkboxes for that. The standard way to let the user choose what to install is to use the [Types] and [Components] sections of your script file. Take a look at the Components. iss script located in your Inno Setup install folder\examples.


1 Answers

Use another [Files] entry with the external flag:

[Files]
Source: "{app}\extractor.prop"; DestDir: "{app}"; DestName: "extractor.prop.old"; Flags: external skipifsourcedoesntexist

This is what external does:

external

This flag instructs Inno Setup not to statically compile the file specified by the Source parameter into the installation files, but instead copy from an existing file on the distribution media or the user's system. See the Source parameter description for more information.

(source)

like image 122
Deanna Avatar answered Oct 09 '22 18:10

Deanna