On Thursday, 28 July 2016 at 00:42:11 UTC, crimaniak wrote:
On Wednesday, 27 July 2016 at 13:59:23 UTC, Jonathan Marler wrote:

For others who may see this thread, the __FULL_FILE_PATH__ special trait was added to the dmd compiler with this PR: https://github.com/dlang/dmd/pull/5959

__DIR__ will be useful, I think. Just directory name, without file name.

Sure if others thought it was a good idea. I wouldn't really mind typing __FILE_FULL_PATH__.dirName, but others might find __DIR__ useful. Good thing is that it could be added to the standard library (wouldn't have to change the compiler) now that __FULL_FILE_PATH__ has been added. I'm guessing it would have to be a function like this:

auto __DIR__(string fileFullPath = __FILE_FULL_PATH__) pure
{
    return fileFullPath.dirName;
}

May or may not be useful enough to be added to druntime or phobos, I'll let someone else decide that :)

Reply via email to