From bc219b6a1ebf78319f8fdf6d179bf83f88b4467e Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 7 Sep 2025 15:54:57 +0200 Subject: [PATCH] Use normalized path in LuaUi::TextureData --- apps/openmw/mwlua/uibindings.cpp | 2 +- components/lua_ui/resources.cpp | 2 -- components/lua_ui/resources.hpp | 7 ++++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwlua/uibindings.cpp b/apps/openmw/mwlua/uibindings.cpp index 7c708fefa9..fe44a107f0 100644 --- a/apps/openmw/mwlua/uibindings.cpp +++ b/apps/openmw/mwlua/uibindings.cpp @@ -231,7 +231,7 @@ namespace MWLua LuaUi::TextureData data; sol::object path = LuaUtil::getFieldOrNil(options, "path"); if (path.is()) - data.mPath = path.as(); + data.mPath = VFS::Path::Normalized(path.as()); if (data.mPath.empty()) throw std::logic_error("Invalid texture path"); sol::object offset = LuaUtil::getFieldOrNil(options, "offset"); diff --git a/components/lua_ui/resources.cpp b/components/lua_ui/resources.cpp index 6c98292765..2bd26a4f63 100644 --- a/components/lua_ui/resources.cpp +++ b/components/lua_ui/resources.cpp @@ -6,8 +6,6 @@ namespace LuaUi { std::shared_ptr ResourceManager::registerTexture(TextureData data) { - VFS::Path::normalizeFilenameInPlace(data.mPath); - TextureResources& list = mTextures[data.mPath]; list.push_back(std::make_shared(data)); return list.back(); diff --git a/components/lua_ui/resources.hpp b/components/lua_ui/resources.hpp index f2e1753a2c..a472f954db 100644 --- a/components/lua_ui/resources.hpp +++ b/components/lua_ui/resources.hpp @@ -2,12 +2,13 @@ #define OPENMW_LUAUI_RESOURCES #include -#include #include #include #include +#include + namespace VFS { class Manager; @@ -17,7 +18,7 @@ namespace LuaUi { struct TextureData { - std::string mPath; + VFS::Path::Normalized mPath; osg::Vec2f mOffset; osg::Vec2f mSize; }; @@ -33,7 +34,7 @@ namespace LuaUi private: using TextureResources = std::vector>; - std::unordered_map mTextures; + std::unordered_map mTextures; }; }