From 3b7396c4d6a6ffdbbe1ba4aa3c6539640d2cfd06 Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Tue, 23 Jul 2024 19:55:40 +0200 Subject: [PATCH] Fixed enumeration of files. --- source/mijin/virtual_filesystem/relative.hpp | 11 ++++++++++- source/mijin/virtual_filesystem/stacked.cpp | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/mijin/virtual_filesystem/relative.hpp b/source/mijin/virtual_filesystem/relative.hpp index 55fcc20..1aa0245 100644 --- a/source/mijin/virtual_filesystem/relative.hpp +++ b/source/mijin/virtual_filesystem/relative.hpp @@ -63,7 +63,16 @@ fs::path RelativeFileSystemAdapter::getHomeFolder() template std::vector RelativeFileSystemAdapter::listFiles(const fs::path& folder) { - std::vector result = wrapped_.listFiles(root_ / folder); + std::vector result; + fs::path combinedPath = root_; + if (folder.is_absolute()) { + combinedPath += folder; + } + else { + combinedPath /= folder; + } + + result = wrapped_.listFiles(combinedPath); for (FileInfo& fileInfo : result) { fileInfo.path = "/" / fileInfo.path.lexically_relative(root_); } diff --git a/source/mijin/virtual_filesystem/stacked.cpp b/source/mijin/virtual_filesystem/stacked.cpp index c11eb88..2609ba6 100644 --- a/source/mijin/virtual_filesystem/stacked.cpp +++ b/source/mijin/virtual_filesystem/stacked.cpp @@ -68,7 +68,7 @@ std::vector StackedFileSystemAdapter::listFiles(const fs::path& folder { return existing.path == file.path; }); - if (it != files.end()) { + if (it == files.end()) { files.push_back(file); } }