From 9c2a3231c5ee1b15b09bae9b064827ad3dcb86e0 Mon Sep 17 00:00:00 2001
From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
Date: Mon, 13 Feb 2023 01:45:23 -0500
Subject: do not create nilmods folder "it cant be that easy" - me, clueless

Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
---
 launcher/minecraft/mod/ResourceFolderModel.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'launcher/minecraft/mod/ResourceFolderModel.cpp')

diff --git a/launcher/minecraft/mod/ResourceFolderModel.cpp b/launcher/minecraft/mod/ResourceFolderModel.cpp
index fdfb434b..b8353133 100644
--- a/launcher/minecraft/mod/ResourceFolderModel.cpp
+++ b/launcher/minecraft/mod/ResourceFolderModel.cpp
@@ -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);
-- 
cgit 


From dc8109658c3c178e91acfc316467d1bdffe0bf40 Mon Sep 17 00:00:00 2001
From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
Date: Wed, 22 Feb 2023 13:20:13 -0500
Subject: review fixes

Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
---
 launcher/minecraft/mod/ModFolderModel.cpp          | 2 +-
 launcher/minecraft/mod/ResourceFolderModel.cpp     | 2 +-
 launcher/minecraft/mod/ResourceFolderModel.h       | 3 +--
 launcher/minecraft/mod/tasks/LocalModParseTask.cpp | 9 +++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

(limited to 'launcher/minecraft/mod/ResourceFolderModel.cpp')

diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp
index 2d777656..3f31b93c 100644
--- a/launcher/minecraft/mod/ModFolderModel.cpp
+++ b/launcher/minecraft/mod/ModFolderModel.cpp
@@ -50,7 +50,7 @@
 #include "minecraft/mod/tasks/ModFolderLoadTask.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 };
 }
diff --git a/launcher/minecraft/mod/ResourceFolderModel.cpp b/launcher/minecraft/mod/ResourceFolderModel.cpp
index b8353133..f2a77c12 100644
--- a/launcher/minecraft/mod/ResourceFolderModel.cpp
+++ b/launcher/minecraft/mod/ResourceFolderModel.cpp
@@ -12,7 +12,7 @@
 
 #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) {
         FS::ensureFolderPathExists(m_dir.absolutePath());
diff --git a/launcher/minecraft/mod/ResourceFolderModel.h b/launcher/minecraft/mod/ResourceFolderModel.h
index e4227a33..3bd78870 100644
--- a/launcher/minecraft/mod/ResourceFolderModel.h
+++ b/launcher/minecraft/mod/ResourceFolderModel.h
@@ -24,8 +24,7 @@ class QSortFilterProxyModel;
 class ResourceFolderModel : public QAbstractListModel {
     Q_OBJECT
    public:
-    ResourceFolderModel(QDir, bool, QObject* parent = nullptr);
-    ResourceFolderModel(QDir dir, QObject* parent = nullptr) : ResourceFolderModel(dir, true, parent) {};
+    ResourceFolderModel(QDir, QObject* parent = nullptr, bool create_dir = true);
     ~ResourceFolderModel() override;
 
     /** Starts watching the paths for changes.
diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
index 945ccda7..da27a505 100644
--- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
+++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
@@ -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
         // 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()) {
             // 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") {
-                foundNilMetas.append(fname);
+                foundNilMeta = fname;
+                break;
             }
         }
 
-        if (zip.setCurrentFile(foundNilMetas.at(0))) {
+        if (zip.setCurrentFile(foundNilMeta)) {
             if (!file.open(QIODevice::ReadOnly)) {
                 zip.close();
                 return false;
             }
 
-            details = ReadNilModInfo(file.readAll(), foundNilMetas.at(0));
+            details = ReadNilModInfo(file.readAll(), foundNilMeta);
             file.close();
             zip.close();
 
-- 
cgit