July 27, 2016
https://issues.dlang.org/show_bug.cgi?id=16325

          Issue ID: 16325
           Summary: Provide a construct for a source file to determine
                    where it lives on the file system.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: ASSIGNED
          Severity: enhancement
          Priority: P3
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: johnnymarler@gmail.com

In order to facilitate better scripting capabilities, knowing the absolute location of the original D source file at runtime is very useful. Batch scripts have this capability with the %~dp0 and is a vital feature for many use cases.

--