如何在Lazarus中获取项目源文件夹? (ComponentEditor)

huangapple go评论76阅读模式
英文:

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

问题

在给出负面评价之前:我理解编译后的软件无法访问源代码。然而,这个问题是为了ComponentEditor而提出的。

在LCL和Linux下创建自定义组件,我现在正在创建编辑器,它需要访问项目的源代码文件夹来生成/管理元数据文件并将它们添加到资源(*.rc)中。

在Embarcadero-Delphi中,我可以使用ToolsAPI单元中的GetActiveProject.fileName来实现这一点。

在跨平台的LCL中,等同于GetActiveProject.fileName以获取自定义组件编辑器中项目源代码目录的方法是什么?

Delphi示例:

ProjectDir := ExtractFilePath( GetActiveProject.fileName );
英文:

Before to downvote: 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 );

答案1

得分: 1

根据 https://www.freepascal.org/~michael/articles/lazide1/lazide1.pdfOpen Tools API 的等价物是 Lazarus IDE 接口

https://www.freepascal.org/~michael/articles/lazide2/lazide2.pdf 中有更多关于它们的信息...

英文:

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...

huangapple
  • 本文由 发表于 2023年7月6日 19:54:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628567.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定