[Lazarus] Cross-platform using TRegistry - how to?

Michael Van Canneyt michael at freepascal.org
Mon May 4 11:33:43 CEST 2020



On Mon, 4 May 2020, Bart via lazarus wrote:

> On Mon, May 4, 2020 at 12:41 AM Bo Berglund via lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
>> structure:
>
>> HKLM\SOFTWARE\Companyname\Applicationname\Server\(named values)
>> HKLM\SOFTWARE\Companyname\Applicationname\Configuration\(named values)
>
> The *nix way is to use .conf files (basically ini-files) for that.
> IIRC you have no control over where the xml file (with the registry
> keys) is placed.
> There are some issues with the xml implementation of the registry.
> Most important: TRegIniFile is completely broken and as of 3.2
> deprecated on non-windows platforms.
> Also, when you have 2 keys opened at the same time, reading/writing
> may go to/from the wrong key:
> https://bugs.freepascal.org/view.php?id=36842
>
> For a cross-platform application I wouldn't use TRegistry myself.

Me neither. They're completely windows centric.

That said, I don't even use them on windows.

I use .ini files everywhere for the simple reason they can be edited with any
editor and easily copy & pasted. You can comment out things. 
Basically, they're much easier to use & maintain than the registry.

Michael.


More information about the lazarus mailing list