I happened to look at this just now and thought I'd point out that the constructor for TIniFile requires an exact path to the INI file. This is different than most procedures/functions that will take a relative path.
For example, if MyFileIni.ini is in the same folder as your executable you can't do I:= TIniFile.Create('MyIniFile.ini');. You have to resolve the relative path to a full and explicit path. When there are cases like this, I use a small little function like this:
Code:
function GetHomeDirectory: string;
begin
Result := ExtractFilePath(Paramstr(0));
end;
I think this issue can come up on a few other kinds of things, but I thought I should point this out.
It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
I decided to play with interfaces and wrote an interface around the TIniFile so that I didn't have to free it when I was done. That also allowed me to do things like what Glenn pointed out.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.