Solved

not Updating Ini File

Posted on 2003-11-17
10
330 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 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