diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/file_sys/vfs_layered.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/file_sys/vfs_layered.cpp b/src/core/file_sys/vfs_layered.cpp index da05dd395..3e6426afc 100644 --- a/src/core/file_sys/vfs_layered.cpp +++ b/src/core/file_sys/vfs_layered.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <algorithm> | 4 | #include <algorithm> |
| 5 | #include <set> | ||
| 5 | #include <utility> | 6 | #include <utility> |
| 6 | #include "core/file_sys/vfs_layered.h" | 7 | #include "core/file_sys/vfs_layered.h" |
| 7 | 8 | ||
| @@ -58,11 +59,13 @@ std::string LayeredVfsDirectory::GetFullPath() const { | |||
| 58 | 59 | ||
| 59 | std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const { | 60 | std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const { |
| 60 | std::vector<VirtualFile> out; | 61 | std::vector<VirtualFile> out; |
| 62 | std::set<std::string, std::less<>> out_names; | ||
| 63 | |||
| 61 | for (const auto& layer : dirs) { | 64 | for (const auto& layer : dirs) { |
| 62 | for (const auto& file : layer->GetFiles()) { | 65 | for (const auto& file : layer->GetFiles()) { |
| 63 | if (std::find_if(out.begin(), out.end(), [&file](const VirtualFile& comp) { | 66 | auto file_name = file->GetName(); |
| 64 | return comp->GetName() == file->GetName(); | 67 | if (!out_names.contains(file_name)) { |
| 65 | }) == out.end()) { | 68 | out_names.emplace(std::move(file_name)); |
| 66 | out.push_back(file); | 69 | out.push_back(file); |
| 67 | } | 70 | } |
| 68 | } | 71 | } |