full path to source file __FILE__

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 22 03:51:57 PDT 2016


On Friday, 22 July 2016 at 07:53:17 UTC, Jonathan Marler wrote:
> It's important to remember that the clean.d script is ran with 
> rdmd, and that it is meant to be called from any directory.  
> Since it's ran with rdmd, the thisExePath won't give you the 
> right directory, and since you can call it from any directory, 
> you also can't use the current directory.  As you can see, what 
> you really want to know is where the script itself lives.

Don't just ignore Adam's question :)
https://dlang.org/phobos/std_path.html#.absolutePath
https://dlang.org/phobos/std_file.html#.getcwd - why this won't 
work for you?


More information about the Digitalmars-d-learn mailing list