Resurrect GenericPath.startsWith.
Since the semantics are different w.r.t. path separators, the alternative suggested in the deprecation message is not valid. At least until the comparison/toString semantics of PathSegment have a profound definition, it will be kept around to avoid unneeded interruptions when upgrading to 0.8.x.
This commit is contained in:
parent
2777b0a6ff
commit
24f4e5f70f
|
@ -597,9 +597,12 @@ struct GenericPath(F) {
|
||||||
/// Appends a relative path to this path.
|
/// Appends a relative path to this path.
|
||||||
void opOpAssign(string op : "~", T)(T op) { this = this ~ op; }
|
void opOpAssign(string op : "~", T)(T op) { this = this ~ op; }
|
||||||
|
|
||||||
deprecated("Use .bySegment together with std.algorithm.searching.startsWith instead.")
|
/** Tests whether the given path is a prefix of this path.
|
||||||
|
|
||||||
|
Any path separators will be ignored during the comparison.
|
||||||
|
*/
|
||||||
bool startsWith(GenericPath prefix)
|
bool startsWith(GenericPath prefix)
|
||||||
{
|
const nothrow {
|
||||||
return bySegment.map!(n => n.name).startsWith(prefix.bySegment.map!(n => n.name));
|
return bySegment.map!(n => n.name).startsWith(prefix.bySegment.map!(n => n.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue