From d961ece144c239a61ff46d830041249867656e9c Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 9 Nov 2019 15:11:21 +0100 Subject: Be lenient with extra slashes for CSM paths --- src/client/client.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/client/client.cpp') diff --git a/src/client/client.cpp b/src/client/client.cpp index fd7673a99..0908e52f9 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1881,8 +1881,17 @@ scene::IAnimatedMesh* Client::getMesh(const std::string &filename, bool cache) return mesh; } -const std::string* Client::getModFile(const std::string &filename) +const std::string* Client::getModFile(std::string filename) { + // strip dir delimiter from beginning of path + auto pos = filename.find_first_of(':'); + if (pos == std::string::npos) + return nullptr; + pos++; + auto pos2 = filename.find_first_not_of("/", pos); + if (pos2 > pos) + filename.erase(pos, pos2 - pos); + StringMap::const_iterator it = m_mod_vfs.find(filename); if (it == m_mod_vfs.end()) return nullptr; -- cgit v1.2.3