review fixes
Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
This commit is contained in:
parent
7973b01e81
commit
dc8109658c
@ -50,7 +50,7 @@
|
|||||||
#include "minecraft/mod/tasks/ModFolderLoadTask.h"
|
#include "minecraft/mod/tasks/ModFolderLoadTask.h"
|
||||||
#include "modplatform/ModIndex.h"
|
#include "modplatform/ModIndex.h"
|
||||||
|
|
||||||
ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed, bool create_dir) : ResourceFolderModel(QDir(dir), create_dir), m_is_indexed(is_indexed)
|
ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed, bool create_dir) : ResourceFolderModel(QDir(dir), nullptr, create_dir), m_is_indexed(is_indexed)
|
||||||
{
|
{
|
||||||
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER };
|
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER };
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "tasks/Task.h"
|
#include "tasks/Task.h"
|
||||||
|
|
||||||
ResourceFolderModel::ResourceFolderModel(QDir dir, bool create_dir, QObject* parent) : QAbstractListModel(parent), m_dir(dir), m_watcher(this)
|
ResourceFolderModel::ResourceFolderModel(QDir dir, QObject* parent, bool create_dir) : QAbstractListModel(parent), m_dir(dir), m_watcher(this)
|
||||||
{
|
{
|
||||||
if (create_dir) {
|
if (create_dir) {
|
||||||
FS::ensureFolderPathExists(m_dir.absolutePath());
|
FS::ensureFolderPathExists(m_dir.absolutePath());
|
||||||
|
@ -24,8 +24,7 @@ class QSortFilterProxyModel;
|
|||||||
class ResourceFolderModel : public QAbstractListModel {
|
class ResourceFolderModel : public QAbstractListModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ResourceFolderModel(QDir, bool, QObject* parent = nullptr);
|
ResourceFolderModel(QDir, QObject* parent = nullptr, bool create_dir = true);
|
||||||
ResourceFolderModel(QDir dir, QObject* parent = nullptr) : ResourceFolderModel(dir, true, parent) {};
|
|
||||||
~ResourceFolderModel() override;
|
~ResourceFolderModel() override;
|
||||||
|
|
||||||
/** Starts watching the paths for changes.
|
/** Starts watching the paths for changes.
|
||||||
|
@ -432,21 +432,22 @@ bool processZIP(Mod& mod, ProcessingLevel level)
|
|||||||
// nilloader uses the filename of the metadata file for the modid, so we can't know the exact filename
|
// nilloader uses the filename of the metadata file for the modid, so we can't know the exact filename
|
||||||
// thankfully, there is a good file to use as a canary so we don't look for nil meta all the time
|
// thankfully, there is a good file to use as a canary so we don't look for nil meta all the time
|
||||||
|
|
||||||
QStringList foundNilMetas;
|
QString foundNilMeta;
|
||||||
for (auto& fname : zip.getFileNameList()) {
|
for (auto& fname : zip.getFileNameList()) {
|
||||||
// nilmods can shade nilloader to be able to run as a standalone agent - which includes nilloader's own meta file
|
// nilmods can shade nilloader to be able to run as a standalone agent - which includes nilloader's own meta file
|
||||||
if (fname.endsWith(".nilmod.css") && fname != "nilloader.nilmod.css") {
|
if (fname.endsWith(".nilmod.css") && fname != "nilloader.nilmod.css") {
|
||||||
foundNilMetas.append(fname);
|
foundNilMeta = fname;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zip.setCurrentFile(foundNilMetas.at(0))) {
|
if (zip.setCurrentFile(foundNilMeta)) {
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
zip.close();
|
zip.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
details = ReadNilModInfo(file.readAll(), foundNilMetas.at(0));
|
details = ReadNilModInfo(file.readAll(), foundNilMeta);
|
||||||
file.close();
|
file.close();
|
||||||
zip.close();
|
zip.close();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user