www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - import expression with paths

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:
"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 

So, I suppose it's valid code. But it's still surprising to 
Should it not simply be disallowed completely?
Jan 30 2014