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.