From 84adb0a148a664bd0fbd641e021eac4dea959e0e Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 1 Mar 2024 14:10:25 +0100 Subject: [PATCH] Make VFS::Path::Normalized constructor from std::string_view explicit --- apps/openmw/mwlua/vfsbindings.cpp | 3 ++- components/resource/stats.cpp | 2 +- components/vfs/pathutil.hpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwlua/vfsbindings.cpp b/apps/openmw/mwlua/vfsbindings.cpp index c9b1a45fe2..34a84221f8 100644 --- a/apps/openmw/mwlua/vfsbindings.cpp +++ b/apps/openmw/mwlua/vfsbindings.cpp @@ -328,7 +328,8 @@ namespace MWLua }, [](const sol::object&) -> sol::object { return sol::nil; }); - api["fileExists"] = [vfs](std::string_view fileName) -> bool { return vfs->exists(fileName); }; + api["fileExists"] + = [vfs](std::string_view fileName) -> bool { return vfs->exists(VFS::Path::Normalized(fileName)); }; api["pathsWithPrefix"] = [vfs](std::string_view prefix) { auto iterator = vfs->getRecursiveDirectoryIterator(prefix); return sol::as_function([iterator, current = iterator.begin()]() mutable -> sol::optional { diff --git a/components/resource/stats.cpp b/components/resource/stats.cpp index 6ff2112381..0542ffef28 100644 --- a/components/resource/stats.cpp +++ b/components/resource/stats.cpp @@ -29,7 +29,7 @@ namespace Resource static bool collectStatUpdate = false; static bool collectStatEngine = false; - constexpr std::string_view sFontName = "Fonts/DejaVuLGCSansMono.ttf"; + static const VFS::Path::Normalized sFontName("Fonts/DejaVuLGCSansMono.ttf"); static void setupStatCollection() { diff --git a/components/vfs/pathutil.hpp b/components/vfs/pathutil.hpp index 5c5746cf6f..6e5c5843f3 100644 --- a/components/vfs/pathutil.hpp +++ b/components/vfs/pathutil.hpp @@ -130,7 +130,7 @@ namespace VFS::Path public: Normalized() = default; - Normalized(std::string_view value) + explicit Normalized(std::string_view value) : mValue(normalizeFilename(value)) { }