knowledge-database (beta)

Current group: jrsoftware.innosetup

Dynamically add files into the [Files] section

Dynamically add files into the [Files] section  
Wenbiao Liang
 Re: Dynamically add files into the [Files] section  
Gavin Lambert
 Re: Dynamically add files into the [Files] section  
Merijn Vandenabeele
 Re: Dynamically add files into the [Files] section  
Michael Mattias
From:Wenbiao Liang
Subject:Dynamically add files into the [Files] section
Date:Mon, 20 Dec 2004 16:49:10 -0700
Hi,
I am new with InnoSetup, and I need to create a setup for my application.

There is a application specific configuration file that I need to install,
and the content of the file will change depending on which option(s) the
user has selected in the setup.

I am thinking I will need to dynamically create this file, modify the
content of the file and save it to {app} folder. However, the options the
user needs to select is between wpSelectDir and wpSelectProgramGroup, so at
this time the {app} folder has not been created.

I don't think I should create the {app} folder to write my configuration
file to it, because I fear if the user cancel the installation, then I will
have to delete the folder?

Should I create an empty configuration file and add it into the [Files]
section, and after the installation is done, then modify the file? If I do
this way, will the file get uninstalled if the app is uninstalled?

Any other method? What is the best apporoach to solve this problem?

Thanks!
Wenbiao
From:Gavin Lambert
Subject:Re: Dynamically add files into the [Files] section
Date:Tue, 21 Dec 2004 12:58:19 +1300
Wenbiao Liang wrote:
> I am thinking I will need to dynamically create this file, modify the
> content of the file and save it to {app} folder. However, the options the
> user needs to select is between wpSelectDir and wpSelectProgramGroup, so at
> this time the {app} folder has not been created.

You shouldn't do anything to the user's disk until after the
installation itself starts. Right up until they click Next on the
wpReady page, they should be able to cancel the install and not have had
anything change.

> I don't think I should create the {app} folder to write my configuration
> file to it, because I fear if the user cancel the installation, then I will
> have to delete the folder?

Good call.

> Should I create an empty configuration file and add it into the [Files]
> section, and after the installation is done, then modify the file? If I do
> this way, will the file get uninstalled if the app is uninstalled?

I *think* it will be uninstalled still, but I'm not 100% sure. Try it
and see.

Another approach you can take is to put an AfterInstall handler on a
specific [Files] entry (say, your app's .exe file -- or even the blank
config file itself, if you take that approach). If you don't end up
adding a [Files] entry for the config file, then you can force it to be
deleted by adding an [UninstallDelete] entry for it.
From:Merijn Vandenabeele
Subject:Re: Dynamically add files into the [Files] section
Date:Tue, 21 Dec 2004 07:48:35 +0100
Extract a file template to {tmp} and make your changes there. Then, add an
entrie to [files] with source: {tmp}\YourFileName.ext and flags: external.

Merijn


"Gavin Lambert" schreef in bericht
news:cq7our$go4$1@news.jrsoftware.org...
> Wenbiao Liang wrote:
>> I am thinking I will need to dynamically create this file, modify the
>> content of the file and save it to {app} folder. However, the options the
>> user needs to select is between wpSelectDir and wpSelectProgramGroup, so
>> at this time the {app} folder has not been created.
>
> You shouldn't do anything to the user's disk until after the installation
> itself starts. Right up until they click Next on the wpReady page, they
> should be able to cancel the install and not have had anything change.
>
>> I don't think I should create the {app} folder to write my configuration
>> file to it, because I fear if the user cancel the installation, then I
>> will have to delete the folder?
>
> Good call.
>
>> Should I create an empty configuration file and add it into the [Files]
>> section, and after the installation is done, then modify the file? If I
>> do this way, will the file get uninstalled if the app is uninstalled?
>
> I *think* it will be uninstalled still, but I'm not 100% sure. Try it and
> see.
>
> Another approach you can take is to put an AfterInstall handler on a
> specific [Files] entry (say, your app's .exe file -- or even the blank
> config file itself, if you take that approach). If you don't end up
> adding a [Files] entry for the config file, then you can force it to be
> deleted by adding an [UninstallDelete] entry for it.
From:Michael Mattias
Subject:Re: Dynamically add files into the [Files] section
Date:Tue, 21 Dec 2004 07:34:04 -0600
"Wenbiao Liang" wrote in message
news:cq7odn$gju$1@news.jrsoftware.org...
> Hi,
> I am new with InnoSetup, and I need to create a setup for my application.
>
> There is a application specific configuration file that I need to install,
> and the content of the file will change depending on which option(s) the
> user has selected in the setup.

If it's an "INI" file, you can use the 'tasks' and/or 'components' flags in
the [INI] section to control which keys/what values are written.
   

Copyright © 2006 knowledge-database   -   All rights reserved