Merge pull request #91 from vibe-d/fix_windows_path_bug
Fix WindowsPath.bySegment of an empty path returning a bogus empty segment. merged-on-behalf-of: Leonid Kramer <l-kramer@users.noreply.github.com>
This commit is contained in:
commit
29dae0e3de
|
@ -332,7 +332,7 @@ struct GenericPath(F) {
|
||||||
m_path = m_path[ap.length .. $];
|
m_path = m_path[ap.length .. $];
|
||||||
assert(!m_fronts.empty);
|
assert(!m_fronts.empty);
|
||||||
} else readFront();
|
} else readFront();
|
||||||
}
|
} else assert(m_fronts.empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@property bool empty() const nothrow @nogc { return m_path.length == 0 && m_fronts.empty; }
|
@property bool empty() const nothrow @nogc { return m_path.length == 0 && m_fronts.empty; }
|
||||||
|
@ -897,7 +897,7 @@ struct WindowsPathFormat {
|
||||||
{
|
{
|
||||||
static struct R {
|
static struct R {
|
||||||
S[2] items;
|
S[2] items;
|
||||||
size_t i;
|
size_t i = items.length;
|
||||||
this(S s) { i = 1; items[i] = s; }
|
this(S s) { i = 1; items[i] = s; }
|
||||||
this(S a, S b) { i = 0; items[0] = a; items[1] = b; }
|
this(S a, S b) { i = 0; items[0] = a; items[1] = b; }
|
||||||
@property ref S front() { return items[i]; }
|
@property ref S front() { return items[i]; }
|
||||||
|
@ -1320,3 +1320,7 @@ struct InetPathFormat {
|
||||||
assert(decodeSegment!Segment("foo%20").equal([Segment("foo ")]));
|
assert(decodeSegment!Segment("foo%20").equal([Segment("foo ")]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest { // regression tests
|
||||||
|
assert(NativePath("").bySegment.empty);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue