Hardcoded filepaths in compiled exe

Basile B. b2.temp at gmx.com
Wed Dec 30 04:43:01 UTC 2020


On Wednesday, 30 December 2020 at 01:21:37 UTC, Steven 
Schveighoffer wrote:
> On 12/29/20 7:46 PM, Basile B. wrote:
>> On Tuesday, 29 December 2020 at 23:11:25 UTC, Steven 
>> Schveighoffer wrote:
>>> But I would think a feature should exist that masks the base 
>>> directory of exception file names.
>>>
>>> Probably worth an enhancement request.
>>>
>> 
>> Also aren't dmd output binaries supposed to be "reproducible" ?
>
> If you had an option to change __FILE__ to be canonical, then 
> it could be.
>
> i.e. instead of:
>
> C:\D\dmd2\windows\bin\..\..\src\phobos\std\file.d
>
> you stored:
>
> (imports)\std\file.d
>
> where (imports) (or maybe some other token) was substituted in 
> for the base of every import. Files passed on the command line 
> would just store the __FILE__ as it was passed.
>
> -Steve

actually the string 
"C:\D\dmd2\windows\bin\..\..\src\phobos\std\file.d"
looks like it comes from how the ini file variables are expanded.

__FILE__ is not supposed to represent an absolute file name 
unless the compiler get passed absolute file names. That why 
__FILE_FULL_PATH__ was added at some point.


More information about the Digitalmars-d-learn mailing list