From d6cbb3a3e0d89508e53accac1c2b823dae5e8cc2 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Wed, 19 Sep 2018 21:54:14 -0400 Subject: vfs: Add GetEntries method Maps name string to directory or file. --- src/core/file_sys/vfs_real.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/core/file_sys/vfs_real.cpp') diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index 5e242e20f..a58a02de7 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -413,6 +413,23 @@ std::string RealVfsDirectory::GetFullPath() const { return out; } +std::map RealVfsDirectory::GetEntries() const { + if (perms == Mode::Append) + return {}; + + std::map out; + FileUtil::ForeachDirectoryEntry( + nullptr, path, + [&out](u64* entries_out, const std::string& directory, const std::string& filename) { + const std::string full_path = directory + DIR_SEP + filename; + out.emplace(filename, FileUtil::IsDirectory(full_path) ? VfsEntryType::Directory + : VfsEntryType::File); + return true; + }); + + return out; +} + bool RealVfsDirectory::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) { return false; } -- cgit v1.2.3 From b3c2ec362bbbdd89da9c0aa84b425717f5e3d351 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sun, 23 Sep 2018 21:50:16 -0400 Subject: fsmitm: Cleanup and modernize fsmitm port --- src/core/file_sys/vfs_real.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/vfs_real.cpp') diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index a58a02de7..9defad04c 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -413,11 +413,11 @@ std::string RealVfsDirectory::GetFullPath() const { return out; } -std::map RealVfsDirectory::GetEntries() const { +std::map> RealVfsDirectory::GetEntries() const { if (perms == Mode::Append) return {}; - std::map out; + std::map> out; FileUtil::ForeachDirectoryEntry( nullptr, path, [&out](u64* entries_out, const std::string& directory, const std::string& filename) { -- cgit v1.2.3