Some more FS fixes.
This commit is contained in:
parent
c5b9c02342
commit
75e77c53e4
@ -54,11 +54,13 @@ std::vector<FileInfo> OSFileSystemAdapter::listFiles(const fs::path& folder)
|
||||
info.isHidden = info.path.filename().string().starts_with('.'); // at least for Linux
|
||||
if (info.isFolder)
|
||||
{
|
||||
MIJIN_TRY
|
||||
std::error_code errorCode;
|
||||
fs::directory_iterator dirIt(info.path, errorCode);
|
||||
if (errorCode != std::error_code{})
|
||||
{
|
||||
info.size = std::distance(fs::directory_iterator(info.path), fs::directory_iterator());
|
||||
info.size = std::distance(dirIt, fs::directory_iterator());
|
||||
}
|
||||
MIJIN_CATCH(std::runtime_error&)
|
||||
else
|
||||
{
|
||||
info.size = 0;
|
||||
}
|
||||
|
@ -71,6 +71,10 @@ std::vector<FileInfo> MappingFileSystemAdapter<TWrapped>::listFiles(const fs::pa
|
||||
result = wrapped_.listFiles(adjusted);
|
||||
for (FileInfo& fileInfo : result)
|
||||
{
|
||||
if (fileInfo.path.is_absolute())
|
||||
{
|
||||
fileInfo.path = fs::relative(fileInfo.path, "/");
|
||||
}
|
||||
fileInfo.path = root_ / fileInfo.path;
|
||||
}
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user