From 536370c76df34330bc7b18a9f589578cb8875bf2 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 11 Feb 2023 01:25:00 +0300 Subject: [PATCH] Files::Collections: prefer files from highest priority folders --- CHANGELOG.md | 1 + components/files/collections.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c771a3c0c9..81c9e766a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Bug #7054: Quests aren't sorted by name Bug #7084: Resurrecting an actor doesn't take into account base record changes Bug #7088: Deleting last save game of last character doesn't clear character name/details + Bug #7092: BSA archives from higher priority directories don't take priority Bug #7122: Teleportation to underwater should cancel active water walking effect Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty Feature #5492: Let rain and snow collide with statics diff --git a/components/files/collections.cpp b/components/files/collections.cpp index b556ab06b0..47734bb084 100644 --- a/components/files/collections.cpp +++ b/components/files/collections.cpp @@ -37,9 +37,9 @@ namespace Files std::filesystem::path Collections::getPath(const std::string& file) const { - for (const auto& mDirectorie : mDirectories) + for (auto iter = mDirectories.rbegin(); iter != mDirectories.rend(); iter++) { - for (const auto& iter2 : std::filesystem::directory_iterator(mDirectorie)) + for (const auto& iter2 : std::filesystem::directory_iterator(*iter)) { const auto& path = iter2.path(); const auto str = Files::pathToUnicodeString(path.filename()); @@ -59,9 +59,9 @@ namespace Files bool Collections::doesExist(const std::string& file) const { - for (const auto& mDirectorie : mDirectories) + for (auto iter = mDirectories.rbegin(); iter != mDirectories.rend(); iter++) { - for (const auto& iter2 : std::filesystem::directory_iterator(mDirectorie)) + for (const auto& iter2 : std::filesystem::directory_iterator(*iter)) { const auto& path = iter2.path(); const auto str = Files::pathToUnicodeString(path.filename());