mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
COMMON: Fix Path::baseName
When baseName was called with a base name path but escaped, unescape was called with the escaping marker while this is not allowed.
This commit is contained in:
parent
c30b68115a
commit
b8e08ff2a0
@ -396,6 +396,9 @@ String Path::baseName() const {
|
||||
|
||||
if (separatorPos != String::npos) {
|
||||
begin += separatorPos + 1;
|
||||
} else if (isEscaped()) {
|
||||
// unescape uses the real start, not the escape marker
|
||||
begin++;
|
||||
}
|
||||
end += last;
|
||||
|
||||
|
@ -89,6 +89,9 @@ class PathTestSuite : public CxxTest::TestSuite
|
||||
|
||||
Common::Path p4("parent/dir/file.txt/");
|
||||
TS_ASSERT_EQUALS(p4.baseName(), "file.txt");
|
||||
|
||||
Common::Path p5("File I/O", ':');
|
||||
TS_ASSERT_EQUALS(p5.baseName(), "File I/O");
|
||||
}
|
||||
|
||||
void test_getParent() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user