What is the proper way to detect if the Lazarus IDE is installed in a system programmatically using Delphi?
For example to detect if Delphi 7 is installed I can check this key HKLM\Software\Borland\Delphi\7.0.
I search for a similar key for Lazarus in the Windows registry but I don’t found anything.
Lazarus store a file called
environmentoptions.xmlby default in the<user name>\Local Settings\Application Data\lazarusfolder (in some scenarios this file can be located in other folder). This file contains all the info necessary to get the Lazarus IDE location as well the FPC (Free Pascal compiler) used by the IDE.the
environmentoptions.xmlfile look like thisso the steps necessaries to determine if the Lazarus IDE is installed in a Windows system are
Determine the location of the
<user name>\Local Settings\Application Data\lazarususing theSHGetSpecialFolderLocationfunction with theCSIDL_LOCAL_APPDATAvalue.Parse the file
environmentoptions.xmlto locate theLazarusDirectoryKey under theEnvironmentOptionsroot.Now with the location of the Lazarus IDE you can check the existence of the
lazarus.exefile in that folder.check this sample application which summarize all steps in this answer.