mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 13:17:41 +02:00
fix: load world size async
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -198,22 +198,6 @@ bool putLevelDatDataToFS(const QFileInfo& file, QByteArray& data)
|
||||
return f.commit();
|
||||
}
|
||||
|
||||
int64_t calculateWorldSize(const QFileInfo& file)
|
||||
{
|
||||
if (file.isFile() && file.suffix() == "zip") {
|
||||
return file.size();
|
||||
} else if (file.isDir()) {
|
||||
QDirIterator it(file.absoluteFilePath(), QDir::Files, QDirIterator::Subdirectories);
|
||||
int64_t total = 0;
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
total += it.fileInfo().size();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
World::World(const QFileInfo& file)
|
||||
{
|
||||
repath(file);
|
||||
@ -223,7 +207,6 @@ void World::repath(const QFileInfo& file)
|
||||
{
|
||||
m_containerFile = file;
|
||||
m_folderName = file.fileName();
|
||||
m_size = calculateWorldSize(file);
|
||||
if (file.isFile() && file.suffix() == "zip") {
|
||||
m_iconFile = QString();
|
||||
readFromZip(file);
|
||||
@ -531,3 +514,8 @@ bool World::isMoreThanOneHardLink() const
|
||||
}
|
||||
return FS::hardLinkCount(m_containerFile.absoluteFilePath()) > 1;
|
||||
}
|
||||
|
||||
void World::setSize(int64_t size)
|
||||
{
|
||||
m_size = size;
|
||||
}
|
||||
|
Reference in New Issue
Block a user