Add PathEntry.validateFilename.

This commit is contained in:
Sönke Ludwig 2017-01-19 00:33:52 +01:00
parent 87df128246
commit e80d7244bc
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -446,6 +446,13 @@ unittest
struct PathEntry { struct PathEntry {
import std.string : cmp; import std.string : cmp;
static PathEntry validateFilename(string fname)
@safe {
import std.string : indexOfAny;
enforce(fname.indexOfAny("/\\") < 0, "File name contains forward or backward slashes: "~fname);
return PathEntry(fname, PathType.inet);
}
@safe pure nothrow: @safe pure nothrow:
private { private {