getting __DIR__ and __TIME__ of compilation?

Jacob Carlborg doob at me.com
Fri Dec 27 11:35:22 PST 2013


On 2013-12-27 19:14, Ravn wrote:

> I need the absolute path __FILE__ during compile time,
> so far the only way I know to get absolute paths is by using
> std.path.absolutePath (which uses getcwd() as its base) and getcwd()
> itself (which doesn't seem to work during compile time).
>
> Is there any alternative on how to get the absolute path for a file
> during compile time besides using these functions?

__FILE__ will return the full path (absolute path) of the file currently 
compiling. But that is not the same thing as getting the path to where 
the compilation was made.

I would guess you could use __FILE__ with dirName, but that currently 
does not compile.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list