1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix RemoveRelatvePathComponents

This used to return "/foo" for "../foo" when it should return the enpty
string (i.e., error removing all relative components).
This commit is contained in:
ShadowNinja 2016-12-16 17:35:58 -05:00 committed by Craig Robbins
parent 59f84ca0a0
commit f522e7351a
2 changed files with 23 additions and 17 deletions

View file

@ -251,7 +251,10 @@ void TestFilePath::testRemoveRelativePathComponent()
UASSERT(result == p("/home/user/minetest/worlds/world1"));
path = p(".");
result = fs::RemoveRelativePathComponents(path);
UASSERT(result == ".");
UASSERT(result == "");
path = p("../a");
result = fs::RemoveRelativePathComponents(path);
UASSERT(result == "");
path = p("./subdir/../..");
result = fs::RemoveRelativePathComponents(path);
UASSERT(result == "");