Add check for "." in FSC path (#402)

This commit is contained in:
Tillsunset 2022-10-23 06:06:20 -05:00 committed by GitHub
parent ffa213c794
commit 1bcc064593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,8 @@ class FSCPath
{
if (m_names.size() > 0xFFFF)
return;
if (nameLen == 1 && *name == '.')
return;
m_nodes.emplace_back((uint16)m_names.size(), nameLen);
m_names.insert(m_names.end(), name, name + nameLen);
}
@ -297,6 +299,12 @@ static void FSTPathUnitTest()
cemu_assert_debug(p6.GetNodeCount() == 0);
p6 = FSCPath("/////////////");
cemu_assert_debug(p6.GetNodeCount() == 0);
// test 7 - periods in path
FSCPath p7("/vol/content/./..");
cemu_assert_debug(p7.GetNodeCount() == 3);
cemu_assert_debug(p7.MatchNodeName(0, "vol"));
cemu_assert_debug(p7.MatchNodeName(1, "content"));
cemu_assert_debug(p7.MatchNodeName(2, ".."));
}