Solved

not Updating Ini File

Posted on 2003-11-17
10
332 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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