Inhalt
English (United Kingdom)French (Fr)Deutsch (DE-CH-AT)
Suchen
Login
Wer ist online?
Wir haben 158 Gäste online
Navigation
Home Quellkode Inno Setup Unix-style configuration files with Inno Setup
Aktuell
Featured Articles
Joomla 1.5 Featured Articles
Navigation
Home Quellkode 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 E-Mail
Benutzerbewertung: / 14
SchwachPerfekt 
Source Code - Inno Setup
Geschrieben von: Thomas   
Samstag, 30. Mai 2009 um 16:17 Uhr
Beitragsseiten
Unix-style configuration files with Inno Setup
Additional section name
Inno Setup Pascal script code
Alle Seiten

 

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.

 



Zuletzt aktualisiert am Mittwoch, 03. Juni 2009 um 09:52 Uhr
 
Du musst dich anmelden oder registrieren, um einen Kommentar zu schreiben.
Im Forum diskutieren. (0 posts)
Diskutieren (0 Posts)