Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 28, 2016 How to pass Compile Time info to source files | ||||
---|---|---|---|---|
| ||||
Hi, I would like to know how to do something like this http://stackoverflow.com/questions/237542/learning-the-source-codes-filename-at-compile-time using dmd or dub. Can somebody point me in the direction of the doco for this please because I can't find it :( ty ss |
August 28, 2016 Re: How to pass Compile Time info to source files | ||||
---|---|---|---|---|
| ||||
Posted in reply to UDW | Whoops. Forgot to mention that I don't need the path truncation just the info that is exposed by the compiler or build system to source files at compile time and how to retrieve it. Thank you in advance :) |
August 28, 2016 Re: How to pass Compile Time info to source files | ||||
---|---|---|---|---|
| ||||
Posted in reply to UDW | The filename passed to the compiler is easy: __FILE__ works in D too, and you can just strip off extra path info with ordinary functions (like std.path's basename or dirname functions). |
August 28, 2016 Re: How to pass Compile Time info to source files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Sunday, 28 August 2016 at 02:51:13 UTC, Adam D. Ruppe wrote:
> The filename passed to the compiler is easy: __FILE__ works in D too, and you can just strip off extra path info with ordinary functions (like std.path's basename or dirname functions).
Thanks Adam. Worked like a charm.
|
Copyright © 1999-2021 by the D Language Foundation