mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 22:50:38 +03:00
Fixed bug 2322: Paths on Windows sometimes must include the trailing separator
This commit is contained in:
parent
3ac4dbb828
commit
25d0ef1dd2
1 changed files with 6 additions and 1 deletions
|
@ -376,7 +376,10 @@ string dirname(string fullname)
|
|||
break;
|
||||
if (fullname[i - 1] == sep[0] || fullname[i - 1] == altsep[0])
|
||||
{
|
||||
i--;
|
||||
// Leave separator when it's the starting character (current root)
|
||||
// or when it's preceded by ':' (absolute root)
|
||||
if (i != 1 && fullname[i - 2] != ':')
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -404,6 +407,8 @@ unittest
|
|||
version (Win32)
|
||||
{
|
||||
assert(dirname(r"\path\to\file") == r"\path\to");
|
||||
assert(dirname(r"\foo") == r"\");
|
||||
assert(dirname(r"c:\foo") == r"c:\");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue