Make Path::SetExtension("") not include a dot
parent
f5086b62cc
commit
a8b8a347c1
|
@ -185,8 +185,10 @@ Path Path::WithExtension(std::string ext) const {
|
|||
if(dot != std::string::npos) {
|
||||
withExt.raw.erase(dot);
|
||||
}
|
||||
if(!ext.empty()) {
|
||||
withExt.raw += ".";
|
||||
withExt.raw += ext;
|
||||
}
|
||||
return withExt;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ TEST_CASE(extension) {
|
|||
}
|
||||
|
||||
TEST_CASE(with_extension) {
|
||||
CHECK_EQ_STR(Path::From("foo.bar").WithExtension("").raw, "foo");
|
||||
CHECK_EQ_STR(Path::From("foo.bar").WithExtension("baz").raw, "foo.baz");
|
||||
CHECK_EQ_STR(Path::From("foo").WithExtension("baz").raw, "foo.baz");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue