[Lazarus] Getting a program's "true name"
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Mon Oct 25 11:55:29 CEST 2010
Marco van de Voort wrote:
>> Going back to my original question, can I put something like this
>>
>> -dprojectname=heavy_wethers
>>
>> or even
>>
>> -dprojectname=$ProjFile()
>>
>> in the project settings, and then use it as
>>
>> projectName:= {$I %projectname% } ;
>
> Not that I know. Via environment variables is the only way. I thought a
> while back to do this via macros ( -dxxx:=yyy syntax), so that it could also
> be on the cmdline:
>
> http://bugs.freepascal.org/view.php?id=12935
Ah- I hadn't thought of := on the command line :-) OK, situation as of
0.9.28.3 + 2.4.0 appears to be that the compiler ignores = (i.e. stores
the whole thing as a shell variable) but breaks on := (i.e. stores the
left-hand part only), however it only defines the shell variable, it
doesn't assign it a value. Much the same for 27705 + 2.4.2-rc1 (I'm not
complaining, only summarising).
Since := is significant in the -d option I wonder whether fpc -h should
be updated.
However the whole thing is slightly academic since Mattias has
contributed his
> In project1.lpr add
>
> uses FileUtil;
>
> ProjectName := ExtractFilenameOnly({$I %file%});
which looks like it will handle the project name issue perfectly.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the Lazarus
mailing list