Compile time filesystem access?

bls bizprac at orange.fr
Mon Jan 30 08:11:09 PST 2012


On 01/30/2012 07:18 AM, Adam D. Ruppe wrote:
> On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:
>> I want to know if a library is present, and automatically disable
>> non-vital features if it isn't.
>
> I'd like it too... here's what I tried. It doesn't
> work, though.

I am afraid I miss the point but shouldn't module ctors help.. f.i.

module m;
import std.file;
static this()  // module ctor
{
	if ("/usr/share/include/my.lib".isDir)
		import my;
	else
		import other;
		
}

Not tested!


More information about the Digitalmars-d mailing list