fix: consider all mounts for listDirectory
This commit is contained in:
+16
-4
@@ -3,6 +3,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <set>
|
||||
|
||||
using namespace seallib;
|
||||
|
||||
@@ -155,11 +156,22 @@ VFSResult VirtualFileSystem::createDirectory(const std::string& path)
|
||||
std::vector<std::string> VirtualFileSystem::listDirectory(const std::string& path) const
|
||||
{
|
||||
std::shared_lock lock(_mutex);
|
||||
std::string relativePath;
|
||||
const MountPoint* mount = findBestMount(path, relativePath);
|
||||
std::string searchPath = trimPathSeparators(normalizePath(path));
|
||||
|
||||
if (!mount) return {};
|
||||
return mount->provider->listDirectory(relativePath);
|
||||
std::set<std::string> mergedFiles;
|
||||
|
||||
for (const auto& mount : _mounts)
|
||||
{
|
||||
std::string relativePath;
|
||||
if (getRelativePath(mount, searchPath, relativePath))
|
||||
{
|
||||
auto files = mount.provider->listDirectory(relativePath);
|
||||
for (const auto& f : files)
|
||||
mergedFiles.insert(f);
|
||||
}
|
||||
}
|
||||
|
||||
return {mergedFiles.begin(), mergedFiles.end()};
|
||||
}
|
||||
|
||||
std::string VirtualFileSystem::normalizePath(const std::string& path) const
|
||||
|
||||
Reference in New Issue
Block a user