MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / calculateFileSize

Function calculateFileSize

launcher/minecraft/mod/Resource.cpp:24–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24std::tuple<QString, qint64> calculateFileSize(const QFileInfo& file)
25{
26 if (file.isDir()) {
27 auto dir = QDir(file.absoluteFilePath());
28 dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);
29 auto count = dir.count();
30 auto str = QObject::tr("item");
31 if (count != 1)
32 str = QObject::tr("items");
33 return { QString("%1 %2").arg(QString::number(count), str), count };
34 }
35 return { StringUtils::humanReadableFileSize(file.size(), true), file.size() };
36}
37
38void Resource::parseFile()
39{

Callers 1

parseFileMethod · 0.85

Calls 5

QStringClass · 0.85
QDirClass · 0.50
setFilterMethod · 0.45
countMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected