Thread overview
[Issue 10209] string import doesn't work with dmd -J/ /path/to//file.d
Feb 03, 2018
Seb
Feb 03, 2018
Timothee Cour
Dec 17, 2022
Iain Buclaw
February 03, 2018
https://issues.dlang.org/show_bug.cgi?id=10209

Seb <greensunny12@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |greensunny12@gmail.com
         Resolution|---                         |WONTFIX

--- Comment #2 from Seb <greensunny12@gmail.com> ---
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

--
February 03, 2018
https://issues.dlang.org/show_bug.cgi?id=10209

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |timothee.cour2@gmail.com
         Resolution|WONTFIX                     |---

--- Comment #3 from Timothee Cour <timothee.cour2@gmail.com> ---
> 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 `//`.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=10209

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--