Solved

not Updating Ini File

Posted on 2003-11-17
10
333 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
Technology Partners: 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

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!

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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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