diff options
| author | 2018-09-19 21:54:14 -0400 | |
|---|---|---|
| committer | 2018-09-21 19:53:05 -0400 | |
| commit | d6cbb3a3e0d89508e53accac1c2b823dae5e8cc2 (patch) | |
| tree | a3a84cdbe3dead1399c8c6d4bdf5c2c394be5b73 /src/core/file_sys/vfs.cpp | |
| parent | common_paths: Add Load and Dump dirs (diff) | |
| download | yuzu-d6cbb3a3e0d89508e53accac1c2b823dae5e8cc2.tar.gz yuzu-d6cbb3a3e0d89508e53accac1c2b823dae5e8cc2.tar.xz yuzu-d6cbb3a3e0d89508e53accac1c2b823dae5e8cc2.zip | |
vfs: Add GetEntries method
Maps name string to directory or file.
Diffstat (limited to 'src/core/file_sys/vfs.cpp')
| -rw-r--r-- | src/core/file_sys/vfs.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp index d7b52abfd..1ddfb7600 100644 --- a/src/core/file_sys/vfs.cpp +++ b/src/core/file_sys/vfs.cpp | |||
| @@ -399,6 +399,15 @@ bool VfsDirectory::Copy(std::string_view src, std::string_view dest) { | |||
| 399 | return f2->WriteBytes(f1->ReadAllBytes()) == f1->GetSize(); | 399 | return f2->WriteBytes(f1->ReadAllBytes()) == f1->GetSize(); |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | std::map<std::string, VfsEntryType> VfsDirectory::GetEntries() const { | ||
| 403 | std::map<std::string, VfsEntryType> out; | ||
| 404 | for (const auto& dir : GetSubdirectories()) | ||
| 405 | out.emplace(dir->GetName(), VfsEntryType::Directory); | ||
| 406 | for (const auto& file : GetFiles()) | ||
| 407 | out.emplace(file->GetName(), VfsEntryType::File); | ||
| 408 | return out; | ||
| 409 | } | ||
| 410 | |||
| 402 | std::string VfsDirectory::GetFullPath() const { | 411 | std::string VfsDirectory::GetFullPath() const { |
| 403 | if (IsRoot()) | 412 | if (IsRoot()) |
| 404 | return GetName(); | 413 | return GetName(); |