[Lazarus] __FILE__ macro, or equivalent

Donald Ziesig donald at ziesig.org
Fri Jul 29 21:33:55 CEST 2016


On 07/29/2016 01:47 PM, Mark Morgan Lloyd wrote:
> Donald Ziesig wrote:
>> Hi All!
>>
>> I would like to get the path to an fpc package at compile time. I 
>> have a package which needs to load some .so files and I would like to 
>> store them in a location that will be consistent when I move the 
>> package from system to system.  By getting the package path, I could 
>> store them in the package directory.
>>
>> Is that possible?
>>
>> I tried to use the __FILE__ macro like in C/C++ but the compiler 
>> doesn't seem to understand it.
>
> Try something like
>
> B5k5_Project := {$I %FILE% } ;        (* Possibly used for .ini files 
> etc.    *)
>
> http://www.freepascal.org/docs-html/current/prog/progsu41.html#x48-470001.2.41 
>
>
Thanks Mark,


Unfortunately, that directive only returns the file name itself, without 
the path.  The documentation does not show any %xxx% symbol that returns 
the full file path, which is what I need.  I will have to set an 
environment variable to do what I want, but that will leave me with just 
one more thing to forget when I port the package :-(.


Don



More information about the Lazarus mailing list