Fixed enumeration of files.

This commit is contained in:
Patrick 2024-07-23 19:55:40 +02:00
parent 7aa1edcea0
commit 3b7396c4d6
2 changed files with 11 additions and 2 deletions

View File

@ -63,7 +63,16 @@ fs::path RelativeFileSystemAdapter<TWrapped>::getHomeFolder()
template<typename TWrapped>
std::vector<FileInfo> RelativeFileSystemAdapter<TWrapped>::listFiles(const fs::path& folder)
{
std::vector<FileInfo> result = wrapped_.listFiles(root_ / folder);
std::vector<FileInfo> 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_);
}

View File

@ -68,7 +68,7 @@ std::vector<FileInfo> StackedFileSystemAdapter::listFiles(const fs::path& folder
{
return existing.path == file.path;
});
if (it != files.end()) {
if (it == files.end()) {
files.push_back(file);
}
}