mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Improve mod parsing
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
8cace06df9
commit
27259ff52d
3 changed files with 103 additions and 141 deletions
|
|
@ -244,35 +244,23 @@ void World::readFromZip(const QFileInfo& file)
|
|||
{
|
||||
MMCZip::ArchiveReader r(file.absoluteFilePath());
|
||||
|
||||
if (m_isValid = r.collectFiles(); !m_isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString path;
|
||||
const QString levelDat = "level.dat";
|
||||
for (auto filePath : r.getFiles()) {
|
||||
m_isValid = false;
|
||||
r.parse([this](MMCZip::ArchiveReader::File* file, bool& stop) {
|
||||
const QString levelDat = "level.dat";
|
||||
auto filePath = file->filename();
|
||||
QFileInfo fi(filePath);
|
||||
if (fi.fileName().compare(levelDat, Qt::CaseInsensitive) == 0) {
|
||||
m_containerOffsetPath = filePath.chopped(levelDat.length());
|
||||
path = filePath;
|
||||
break;
|
||||
if (!m_containerOffsetPath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
m_levelDatTime = file->dateTime();
|
||||
loadFromLevelDat(file->readAll());
|
||||
m_isValid = true;
|
||||
stop = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_isValid = !m_containerOffsetPath.isEmpty(); !m_isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto zippedFile = r.goToFile(path);
|
||||
if (m_isValid = !!zippedFile; !m_isValid) {
|
||||
return;
|
||||
}
|
||||
// read the install profile
|
||||
m_levelDatTime = zippedFile->dateTime();
|
||||
if (!m_isValid) {
|
||||
return;
|
||||
}
|
||||
loadFromLevelDat(zippedFile->readAll());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool World::install(const QString& to, const QString& name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue