Bug 16325 – Provide a construct for a source file to determine where it lives on the file system.

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-27T13:51:00Z
Last change time
2016-07-27T13:53:51Z
Assigned to
johnnymarler
Creator
johnnymarler

Comments

Comment #0 by johnnymarler — 2016-07-27T13:51:29Z
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.
Comment #1 by johnnymarler — 2016-07-27T13:53:09Z
Was implemented here: https://github.com/dlang/dmd/pull/5959 Adds a new special compiler trait __FILE_FULL_PATH__ that reduces to the absolute path of the current source file.