delphifreepascallazarus

How to get the project source folder in Lazarus? (ComponentEditor)


I understand that a compiled software has no access to the sources. However, this question is intended for the ComponentEditor.

Creating a custom component under LCL & Linux, I am creating now the editor, which would need access to the sources folder of the project to generate/manage metadata files and add them to the resources (*.rc).

Under Embarcadero-Delphi, I can do this with GetActiveProject.fileName from ToolsAPI unit.

What is the cross-platform LCL equivalent to GetActiveProject.fileName to get the project source directory in a custom component editor?

Example in Delphi:

ProjectDir := ExtractFilePath( GetActiveProject.fileName );

Solution

  • As explained at https://www.freepascal.org/~michael/articles/lazide1/lazide1.pdf the equivalent of Open Tools API are Lazarus IDE interface.

    Here https://www.freepascal.org/~michael/articles/lazide2/lazide2.pdf more information about them...