PDA

View Full Version : Modifying INI file


StevenJ
11-10-2004, 02:36 PM
Can someone show or tell me how to read an existing INI file and modify it if certain text is present? For example; I have a setup.ini file that reads like this:

[setup]
Directory=C:\program files\install\data
DirectoryIconFile=C:\program files\install\data\images




I want to be able to check this file for the following two entries when I update the program:

Directory=C:\program files\install\data
DirectoryIconFile=C:\program files\install\data\images

and if they are present I would like to modify them to read:


[setup]
Directory=C:\install\data
DirectoryIconFile=C:\install\data\images

essentially changing the path.

Can this be done? I tried using 'Modify ini', but can't get it to work.

Thanks!