Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-07

Package physical location (directory)

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dmitry Boyarintsev

Hi,

How a package (first-time installed) could know its physical location? Specifically the physical location of .lpk file.

The path is needed for a package that depends on external configuration/template files.
It would be nice, if the package could find the external files automatically, rather than asking the user to point to the package directory.

Having these initial configuration/template files as constants in the code is undesirable from maintenance point of view.

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160727/ac7a3028/attachment.html>

Reply by email

Mattias Gaertner
to Dmitry Boyarintsev
Show quoted text 13 lines
Hi, How a package (first-time installed) could know its physical location? Specifically the physical location of .lpk file. The path is needed for a package that depends on external configuration/template files. It would be nice, if the package could find the external files automatically, rather than asking the user to point to the package directory. Having these initial configuration/template files as constants in the code is undesirable from maintenance point of view.

Do you mean, how can a package installed in the IDE find its lpk?

Mattias

Reply by email

Fabio Luis Girardi
to Mattias Gaertner

I don't know if this applies to you, but, If you package depends of some packages that is distributed together with your package, Lazarus has a way to store the path of your package dependency.

The best regards,

Fabio

2016-07-28 4:53 GMT-03:00 Mattias Gaertner :

Show quoted text 27 lines
On Wed, 27 Jul 2016 16:43:33 -0400 Dmitry Boyarintsev wrote: > Hi, > > How a package (first-time installed) could know its physical location? > Specifically the physical location of .lpk file. > > The path is needed for a package that depends on external > configuration/template files. > It would be nice, if the package could find the external files > automatically, rather than asking the user to point to the package > directory. > > Having these initial configuration/template files as constants in the code > is undesirable from maintenance point of view. Do you mean, how can a package installed in the IDE find its lpk? Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160728/94466a89/attachment.html>

Reply by email

Dmitry Boyarintsev
to Mattias Gaertner: On Wed, 27 Jul 2016 16:43:33 -0400 Do you mean, how can a package installed in the IDE…

On Thu, Jul 28, 2016 at 3:53 AM, Mattias Gaertner <

Show quoted text 6 lines
wrote: Do you mean, how can a package installed in the IDE find its lpk? Pretty much - yes,

Lets say I've a package

packagedir/
./package.lpk
./package.sh
./package.pas
.
Package is introducing a button into IDE, that does something. On the press of the button I need to execute the script (package.sh). However, I cannot do that, unless I know the path to it. I need to know this path in run-time:

  pth := GetPackageDir('package'); // do the search by package name
  pth := IncludePathDelimiter(pth)+ 'package.sh';
  RunCommand('bash', pth);

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160728/a0244a3b/attachment.html>

Reply by email

Dmitry Boyarintsev
to Mattias Gaertner

On Thu, Jul 28, 2016 at 11:10 AM, Mattias Gaertner <

Show quoted text 12 lines
wrote: On Thu, 28 Jul 2016 08:16:03 -0400 Dmitry Boyarintsev wrote: >[...] > pth := GetPackageDir('package'); // do the search by package name See here: http://wiki.lazarus.freepascal.org/Extending_the_IDE#Get_lpk_filename_of_an_installed_package

Thank you! I couldn't ask for more!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160728/eb305835/attachment-0002.html>

Reply by email