From 2ddc77138a9c1a9620e3eb97e8e8fe2f7db9e1cd Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 18 Sep 2024 23:52:20 +0200 Subject: [PATCH] Use normalized path in ESM4 reader --- components/esm4/reader.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/esm4/reader.cpp b/components/esm4/reader.cpp index 2d9a929bb2..505922601d 100644 --- a/components/esm4/reader.cpp +++ b/components/esm4/reader.cpp @@ -320,16 +320,18 @@ namespace ESM4 std::filesystem::path path = strings / (prefix + language + suffix); if (mVFS != nullptr) { - std::string vfsPath = Files::pathToUnicodeString(path); - if (!mVFS->exists(vfsPath)) + VFS::Path::Normalized vfsPath(Files::pathToUnicodeString(path)); + Files::IStreamPtr stream = mVFS->find(vfsPath); + + if (stream == nullptr) { path = strings / (prefix + altLanguage + suffix); - vfsPath = Files::pathToUnicodeString(path); + vfsPath = VFS::Path::Normalized(Files::pathToUnicodeString(path)); + stream = mVFS->find(vfsPath); } - if (mVFS->exists(vfsPath)) + if (stream != nullptr) { - const Files::IStreamPtr stream = mVFS->get(vfsPath); buildLStringIndex(stringType, *stream); return; }