vfs: Add GetEntries method
Maps name string to directory or file.
This commit is contained in:
parent
bd8db3f7f8
commit
d6cbb3a3e0
4 changed files with 32 additions and 0 deletions
|
@ -399,6 +399,15 @@ bool VfsDirectory::Copy(std::string_view src, std::string_view dest) {
|
|||
return f2->WriteBytes(f1->ReadAllBytes()) == f1->GetSize();
|
||||
}
|
||||
|
||||
std::map<std::string, VfsEntryType> VfsDirectory::GetEntries() const {
|
||||
std::map<std::string, VfsEntryType> out;
|
||||
for (const auto& dir : GetSubdirectories())
|
||||
out.emplace(dir->GetName(), VfsEntryType::Directory);
|
||||
for (const auto& file : GetFiles())
|
||||
out.emplace(file->GetName(), VfsEntryType::File);
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string VfsDirectory::GetFullPath() const {
|
||||
if (IsRoot())
|
||||
return GetName();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue