From f6865117e47fb48c58ab53af1297a79b850a345a Mon Sep 17 00:00:00 2001 From: spycrab Date: Sat, 2 Jun 2018 18:14:42 +0200 Subject: Qt/FilesystemWidget: Add size column --- Source/Core/DiscIO/Filesystem.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/Filesystem.cpp') diff --git a/Source/Core/DiscIO/Filesystem.cpp b/Source/Core/DiscIO/Filesystem.cpp index 9e5336db5d..68a7decb3e 100644 --- a/Source/Core/DiscIO/Filesystem.cpp +++ b/Source/Core/DiscIO/Filesystem.cpp @@ -8,6 +8,19 @@ namespace DiscIO { FileInfo::~FileInfo() = default; +u64 FileInfo::GetTotalSize() const +{ + if (!IsDirectory()) + return GetSize(); + + u64 size = 0; + + for (const auto& entry : *this) + size += entry.GetTotalSize(); + + return size; +} + FileSystem::~FileSystem() = default; -} // namespace +} // namespace DiscIO -- cgit v1.2.3