Contenu
English (United Kingdom)French (Fr)Deutsch (DE-CH-AT)
Rechercher
Login
Qui est en ligne?
Nous avons 181 invités en ligne
Navigation
Home Code source Inno Setup Unix-style configuration files with Inno Setup
Les plus récents
Articles vedettes
Joomla 1.5 Featured Articles
Navigation
Home Code source Inno Setup Unix-style configuration files with Inno Setup
English (United Kingdom)French (Fr)Deutsch (DE-CH-AT)
Unix-style configuration files with Inno Setup Envoyer
Note des utilisateurs: / 14
MauvaisTrès bien 
Code source - Inno Setup
Écrit par Thomas   
Samedi, 30 Mai 2009 16:17
Index de l'article
Unix-style configuration files with Inno Setup
Additional section name
Inno Setup Pascal script code
Toutes les pages

 

Inno Setup is a Windows application, and therefore it is easy to create or modify Windows-style configuration files with it. Windows configuration files are sometimes referred to as ini files because of their filename extension '.ini'. Unix-style configuration files don't have section names, but that does not mean they can't be handled with Inno Setup.

 

Windows ini files can be created or modified with entries in Inno Setup's [Ini] section. An Inno Setup [Ini] section entry must specify a filename (the configiuration file), a section name (ini files are split up in sections), a key name (which turns up as 'key=...' in the file), and a value (everything on the right side of the '=' character). Inno Setup [Ini] section entries are basically wrappers for Windows' WritePrivateProfileString () API function.

Here's an example for a Windows configuration file (ini file):

[Section]

key=value

setting=This is my setting

WindowWidth=400

Wikipedia explains ini files in more detail: Ini file on Wikipedia

 

This configuration file format has been with Windows at least since Windows 3.1, and other operating systems like OS/2 supported it too. It was the standard way of preserving settings on Windows systems before Microsoft introduced the Windows registry. Ini files are still more compact than for example XML files.

The hassle starts with software that does not use standard ini files.

More and more software for Windows has its roots on Unix/Linux. Since the ini file format is more or less native to Windows, most Unix software uses slightly different configuration files. Inno Setup does by default not support the Unix-style config file format.

The files look pretty much like Windows ini files but don't have sections. They usually only consist of configuration entries and comments:

key=value

# This is a comment.

setting=This is my setting

WindowWidth=400

 

There are several possible methods to handle Unix-style configuration files with Inno Setup, and they are all quite valuable for their purposes.

  • An external direct link library (DLL).
  • The trick with an additional section name.
  • Some [Code] in Inno Setup.

Writing an external DLL just to read and write some configuration settings for a particular file format seems overkill at first. A closer look reveals that there can very well be good reasons for this approach. For example, if a helper DLL exists already, the effort of squeezing a few more functions in to handle configurations might be worth a few lines of code.

 



Mise à jour le Mercredi, 03 Juin 2009 09:52
 
You need to login or register to post comments.
Discutez de ceci sur le forum. (0 posts)
Discutez de (0 posts)