Bug 10209 – string import doesn't work with dmd -J/ /path/to//file.d

Status
REOPENED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-29T14:14:32Z
Last change time
2024-12-13T18:07:12Z
Assigned to
No Owner
Creator
thelastmammoth
Moved to GitHub: dmd#17586 →

Comments

Comment #0 by thelastmammoth — 2013-05-29T14:14:32Z
problem when a path argument given to dmd contains a '//' instead of '/': dmd dmd -J/ /path/to//file.d /path/to/file.d: ---- void main(){ enum a=import(__FILE__);// error:cannot be found or not in a path specified with -J } ---- even though readText(__FILE__) works
Comment #1 by andrej.mitrovich — 2013-05-29T14:17:33Z
Comment #2 by greensunny12 — 2018-02-03T08:40:31Z
That's expected - __FILE__ returns a relative path whereas if you set -J/ it would now require an absolute on. 1) -J. works fine: https://run.dlang.io/is/eOIuJm 2) -J/ needs an absolute path -> __FILE_FULL_PATH__ https://run.dlang.io/is/dV2Q8b 3) readText(__FILE__) works - that's a runtime function - not CTFE which you instructed to search in your current directory 4) -J/ is quite an anti-pattern => closing this as WONTFIX
Comment #3 by timothee.cour2 — 2018-02-03T09:52:49Z
> That's expected - __FILE__ returns a relative path whereas if you set -J/ it would now require an absolute on. That is incorrect, as you can check with `pragma(msg, __FILE__);` __FILE__ returns either a relative or absolute path depending on how the file is given on command line. As you can see in my original example, `dmd -J/ /path/to//file.d` __FILE__ will be absolute. > 4) -J/ is quite an anti-pattern That's irrelevant, I could've used any other path that contains a `//`, eg: `dmd -J. -o- .//main.d` also fails Like I said in the original post (please re-read more carefully): "problem when a path argument given to dmd contains a '//' instead of '/':" Note that -I has no problems with paths that contains a `//`.
Comment #4 by robert.schadek — 2024-12-13T18:07:12Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17586 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB