mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Qt/FilesystemWidget: Add size column
This commit is contained in:
@ -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
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
// The size of a file.
|
||||
// Not guaranteed to return a meaningful value for directories.
|
||||
virtual u32 GetSize() const = 0;
|
||||
// For a file, returns its size. For a directory, returns the total size of its contents.
|
||||
u64 GetTotalSize() const;
|
||||
virtual bool IsDirectory() const = 0;
|
||||
// The number of files and directories in a directory, including those in subdirectories.
|
||||
// Not guaranteed to return a meaningful value for files.
|
||||
@ -124,4 +126,4 @@ public:
|
||||
// because it will check IsValid for you, will automatically pick the right type of filesystem,
|
||||
// and will cache the filesystem in case it's needed again later.
|
||||
|
||||
} // namespace
|
||||
} // namespace DiscIO
|
||||
|
Reference in New Issue
Block a user