Solved

not Updating Ini File

Posted on 2003-11-17
10
328 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
Comment Utility
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
Comment Utility
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
Comment Utility
you have INIFiles in uses?
0
 

Expert Comment

by:Shinez
Comment Utility
hey gmayo you snitched yesterday lol
0
 
LVL 8

Expert Comment

by:gmayo
Comment Utility
Mods watch over your every move... beware!
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Expert Comment

by:Shinez
Comment Utility
lol
0
 

Expert Comment

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

Expert Comment

by:gmayo
Comment Utility
'Fraid not. I did look though.
0
 

Author Comment

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

and now it doesnt anymore ...
0
 

Author Comment

by:Professor
Comment Utility
Ah ... I got it
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 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

11 Experts available now in Live!

Get 1:1 Help Now