diff --git a/components/vfs/manager.cpp b/components/vfs/manager.cpp index d312ce9d84..1bf789402d 100644 --- a/components/vfs/manager.cpp +++ b/components/vfs/manager.cpp @@ -1,6 +1,7 @@ #include "manager.hpp" #include +#include #include #include @@ -44,6 +45,7 @@ namespace VFS Files::IStreamPtr Manager::getNormalized(std::string_view normalizedName) const { + assert(Path::isNormalized(normalizedName)); const auto found = mIndex.find(normalizedName); if (found == mIndex.end()) throw std::runtime_error("Resource '" + std::string(normalizedName) + "' not found"); diff --git a/components/vfs/pathutil.hpp b/components/vfs/pathutil.hpp index 9bcc263842..0856bfffa2 100644 --- a/components/vfs/pathutil.hpp +++ b/components/vfs/pathutil.hpp @@ -15,6 +15,11 @@ namespace VFS::Path return c == '\\' ? '/' : Misc::StringUtils::toLower(c); } + inline constexpr bool isNormalized(std::string_view name) + { + return std::all_of(name.begin(), name.end(), [](char v) { return v == normalize(v); }); + } + inline void normalizeFilenameInPlace(std::string& name) { std::transform(name.begin(), name.end(), name.begin(), normalize);