echo "pragma(msg, import(\"a/b.txt\"));" > test.d mkdir a echo aoeu > a/b.txt dmd -o- -J. test.d Works on Linux. On Windows, complains: test.d(1): Error: file "a/b.txt" cannot be found or not in a path specified with -J test.d(1): while evaluating pragma(msg, import("a/b.txt"))
Looks like FileName::safeSearchPath in filename.c disallows forward slash on Windows. Fixing this should just involve removing it from the blacklist, though there may be security consequences. Side note: the 'More info' link on safeSearchPath to www.securecoding.cert.org leads to a 404 page.
It's not just forward slash that doesn't work: passing in a backwards one or obtaining one via std.path.buildPath still doesn't work.
Update after DDMD: This line is the root cause: https://github.com/D-Programming-Language/dmd/blob/6e787376b89789aef8038ed1f177e94ef7f8bbf0/src/root/filename.d#L480
The commit that added the function: https://github.com/D-Programming-Language/dmd/commit/e15c0ac1475b2afe2ffc32f616e9919077e510db#diff-1b1a4fa25963ae78254a5c4fc1117a60R836
https://github.com/D-Programming-Language/dmd/pull/5337
(In reply to Adam D. Ruppe from comment #5) > https://github.com/D-Programming-Language/dmd/pull/5337 This issue is solved now with 5337 merged right? Should be closed.
Yes. Adam did not format his commit message correctly.