1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 10:36:39 +00:00

Make VFS::Path::Normalized constructor from std::string_view explicit

This commit is contained in:
elsid 2024-03-01 14:10:25 +01:00
parent a63528343d
commit 84adb0a148
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
3 changed files with 4 additions and 3 deletions

View file

@ -328,7 +328,8 @@ namespace MWLua
}, },
[](const sol::object&) -> sol::object { return sol::nil; }); [](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) { api["pathsWithPrefix"] = [vfs](std::string_view prefix) {
auto iterator = vfs->getRecursiveDirectoryIterator(prefix); auto iterator = vfs->getRecursiveDirectoryIterator(prefix);
return sol::as_function([iterator, current = iterator.begin()]() mutable -> sol::optional<std::string> { return sol::as_function([iterator, current = iterator.begin()]() mutable -> sol::optional<std::string> {

View file

@ -29,7 +29,7 @@ namespace Resource
static bool collectStatUpdate = false; static bool collectStatUpdate = false;
static bool collectStatEngine = 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() static void setupStatCollection()
{ {

View file

@ -130,7 +130,7 @@ namespace VFS::Path
public: public:
Normalized() = default; Normalized() = default;
Normalized(std::string_view value) explicit Normalized(std::string_view value)
: mValue(normalizeFilename(value)) : mValue(normalizeFilename(value))
{ {
} }