digitalmars.D.learn - import expression with paths
- Lemonfiend (18/18) Jan 30 2014 This does not compile on Windows, but does compile on Mac:
This does not compile on Windows, but does compile on Mac:
---
module main;
void main()
{
import std.path;
enum bar = import(`dir` ~ dirSeparator ~ `bar.txt`);
}
---
The docs say:
http://dlang.org/expression.html#ImportExpression
"Implementations may restrict the file name in order to avoid
directory traversal security vulnerabilities. A possible
restriction might be to disallow any path components in the file
name."
So, I suppose it's valid code. But it's still surprising to
encounter.
Should it not simply be disallowed completely?
Jan 30 2014








"Lemonfiend" <lemon fie.nd>