[fpc-pascal] Testing existence of a file at compilation time

Sven Barth pascaldragon at googlemail.com
Thu Apr 26 12:01:30 CEST 2012

Am 26.04.2012 11:21 schrieb "Mark Morgan Lloyd" <
markMLl.fpc-pascal at telemetry.co.uk>:
> Is it possible to test for the existence of a file, directory or package
at compilation time, i.e. {$if exists() or similar?
> The specific scenario I'm looking at is where I want to publish a couple
of projects on Berlios, and the functionality will differ depending on
whether a particular (Lazarus) package is available: as an example,
character-by-character (not syntax-defined) colouring which I don't think I
can do in any standard text-output controls. If at compilation time it was
possible to detect that a package was available, it would then be possible
to enable the code that at runtime created a graphical component from that
package without any intervention on the part of the user building the app.

That's currently not possible.

> I've just checked the 2.6.0 manuals: where are things like {$if
declared() defined?

It's in the Programmer's manual:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120426/d3929a6d/attachment.html>

More information about the fpc-pascal mailing list