Skip to content

Commit 39663ea

Browse files
authored
Fix #10742: withExtension should support ranges with mutable properties (#10737)
1 parent 393d826 commit 39663ea

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

std/path.d

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ private auto _stripDrive(R)(R path)
992992
Returns:
993993
index of extension separator (the dot), or -1 if not found
994994
*/
995-
private ptrdiff_t extSeparatorPos(R)(const R path)
995+
private ptrdiff_t extSeparatorPos(R)(R path)
996996
if (isRandomAccessRange!R && hasLength!R && isSomeChar!(ElementType!R) ||
997997
isNarrowString!R)
998998
{
@@ -1280,6 +1280,11 @@ if (isSomeChar!C1 && isSomeChar!C2)
12801280
assert(withExtension("file.ext"w.byWchar, ".").array == "file."w);
12811281
}
12821282

1283+
@safe unittest
1284+
{
1285+
assert(chainPath("directory", "file").withExtension(".ext").array == buildPath("directory", "file.ext"));
1286+
}
1287+
12831288
@safe unittest
12841289
{
12851290
import std.algorithm.comparison : equal;

0 commit comments

Comments
 (0)