full path to source file __FILE__

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 22 12:23:30 PDT 2016


On 7/22/16 2:43 PM, Kagamin wrote:
> On Friday, 22 July 2016 at 13:50:55 UTC, Jonathan Marler wrote:
>> shell/anypath> rdmd /somedir/clean.d
>> Removing /somedir/build...
>
> So for command rdmd /somedir/clean.d what __FILE__ contains? LDC tells
> me the same path as specified on the command line, and that is specified
> relative to current directory, where the compiler is called, so
> absolutePath(__FILE__) should give the right result.

The issue which is not being expressed completely by Jonathan, is that 
rdmd caches the build.

So if I run the script from one directory, then cd elsewhere, it has the 
same __FILE__ as before, but the cwd has moved. So it won't work.

I had assumed rdmd would rebuild, but it doesn't.

-Steve


More information about the Digitalmars-d-learn mailing list