do not create nilmods folder

"it cant be that easy" - me, clueless

Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
This commit is contained in:
kumquat-ir 2023-02-13 01:45:23 -05:00
parent c07fff7503
commit 9c2a3231c5
7 changed files with 11 additions and 8 deletions

View File

@ -1135,7 +1135,7 @@ std::shared_ptr<ModFolderModel> MinecraftInstance::nilModList() const
if (!m_nil_mod_list)
{
bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
m_nil_mod_list.reset(new ModFolderModel(nilModsDir(), is_indexed));
m_nil_mod_list.reset(new ModFolderModel(nilModsDir(), is_indexed, false));
m_nil_mod_list->disableInteraction(isRunning());
connect(this, &BaseInstance::runningStatusChanged, m_nil_mod_list.get(), &ModFolderModel::disableInteraction);
}

View File

@ -50,7 +50,7 @@
#include "minecraft/mod/tasks/ModFolderLoadTask.h"
#include "modplatform/ModIndex.h"
ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed) : ResourceFolderModel(QDir(dir)), m_is_indexed(is_indexed)
ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed, bool create_dir) : ResourceFolderModel(QDir(dir), create_dir), m_is_indexed(is_indexed)
{
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER };
}

View File

@ -75,7 +75,7 @@ public:
Enable,
Toggle
};
ModFolderModel(const QString &dir, bool is_indexed = false);
ModFolderModel(const QString &dir, bool is_indexed = false, bool create_dir = true);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

View File

@ -12,9 +12,11 @@
#include "tasks/Task.h"
ResourceFolderModel::ResourceFolderModel(QDir dir, QObject* parent) : QAbstractListModel(parent), m_dir(dir), m_watcher(this)
ResourceFolderModel::ResourceFolderModel(QDir dir, bool create_dir, QObject* parent) : QAbstractListModel(parent), m_dir(dir), m_watcher(this)
{
FS::ensureFolderPathExists(m_dir.absolutePath());
if (create_dir) {
FS::ensureFolderPathExists(m_dir.absolutePath());
}
m_dir.setFilter(QDir::Readable | QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs);
m_dir.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);

View File

@ -24,7 +24,8 @@ class QSortFilterProxyModel;
class ResourceFolderModel : public QAbstractListModel {
Q_OBJECT
public:
ResourceFolderModel(QDir, QObject* parent = nullptr);
ResourceFolderModel(QDir, bool, QObject* parent = nullptr);
ResourceFolderModel(QDir dir, QObject* parent = nullptr) : ResourceFolderModel(dir, true, parent) {};
~ResourceFolderModel() override;
/** Starts watching the paths for changes.

View File

@ -280,5 +280,5 @@ NilModFolderPage::NilModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolder
bool NilModFolderPage::shouldDisplay() const
{
return !m_model->dir().isEmpty();
return m_model->dir().exists();
}

View File

@ -90,7 +90,7 @@ class NilModFolderPage : public ModFolderPage {
virtual QString displayName() const override { return tr("Nilmods"); }
virtual QIcon icon() const override { return APPLICATION->getThemedIcon("coremods"); }
virtual QString id() const override { return "nilmods"; }
virtual QString helpPage() const override { return "Nil-mods"; }
virtual QString helpPage() const override { return "Nilmods"; }
virtual bool shouldDisplay() const override;
};