Bug 14349 – String imports with subpaths don't work on Windows

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2015-03-27T16:59:04Z
Last change time
2020-03-21T03:56:34Z
Assigned to
No Owner
Creator
Vladimir Panteleev

Comments

Comment #0 by dlang-bugzilla — 2015-03-27T16:59:04Z
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"))
Comment #1 by initrd.gz — 2015-03-30T14:34:00Z
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.
Comment #2 by atila.neves — 2015-06-11T07:54:36Z
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.
Comment #3 by tanel58 — 2016-01-07T17:31:47Z
Comment #4 by tanel58 — 2016-01-07T18:16:49Z
Comment #5 by destructionator — 2016-01-07T18:20:00Z
Comment #6 by andrej.mitrovich — 2016-05-06T21:32:23Z
(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.
Comment #7 by dlang-bugzilla — 2016-05-06T22:46:41Z
Yes. Adam did not format his commit message correctly.