Add PathEntry.validateFilename.
This commit is contained in:
parent
87df128246
commit
e80d7244bc
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue