Solved

not Updating Ini File

Posted on 2003-11-17
10
329 Views
Last Modified: 2010-04-03
In the following bit of code an Ini file is meant to be updated with new configuration data, but for some reason it isnt

const cfgFile = 'ext-pisg.conf'

type tConfig = object
                Lang,
                AppDir,
                PerlExe : String;
                LangAvail : TStringList;
                public procedure Load;
                public procedure Save;
end;

procedure tConfig.Save;
var cfgIni : TMemIniFile;
begin
 cfgIni:=TMemIniFile.Create(cfgFile);
 cfgIni.WriteString('config','language',Lang);
 cfgIni.WriteString('config','perlexe',PerlExe);
 //MessageDlg(cfgIni.FileName,mtInformation,[mbOk],0);
 cfgIni.UpdateFile;

 cfgIni.Free;
end;

The file contains the following data:

[config]
language = german
perlexe = c:\Program Files\ActiveState Komodo 2.5\perl\bin\perl.exe
AppDir = d:\webroot\ircbot\ext-pisg\sourced\

Does anyone have a clue why the file does not get updated?
0
Comment
Question by:Professor
  • 5
  • 3
  • 2
10 Comments
 

Expert Comment

by:Shinez
ID: 9766653
var
cfgIni : TINIFile;

would this work?

you could take off cfgIni.UpdateFile; and see if it works?
0
 
LVL 8

Accepted Solution

by:
gmayo earned 125 total points
ID: 9766659
Be aware that the ini files get saved to the Windows directory and not your working directory. If you set cfgFile to include the path, then it gets saved to that location instead:

const cfgFile = '.\ext-pisg.conf'

Better still, get the program's directory from Application.ExeName.

Geoff M.
0
 

Expert Comment

by:Shinez
ID: 9766660
you have INIFiles in uses?
0
 

Expert Comment

by:Shinez
ID: 9766670
hey gmayo you snitched yesterday lol
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9766715
Mods watch over your every move... beware!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:Shinez
ID: 9766854
lol
0
 

Expert Comment

by:Shinez
ID: 9766860
you know how to change the send packet size of indy icmp gmayo?
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9766945
'Fraid not. I did look though.
0
 

Author Comment

by:Professor
ID: 9767142
strange ... it worked once with the
const cfgFile = '.\ext-pisg.conf'

and now it doesnt anymore ...
0
 

Author Comment

by:Professor
ID: 9767193
Ah ... I got it
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now