From 9cefa3185c70e53ba3d4326b129c0b421a6e7be0 Mon Sep 17 00:00:00 2001 From: ignamiranda Date: Wed, 17 Jan 2024 01:53:22 -0500 Subject: [PATCH] Skip plugins that are already listed as groundcover --- OpenMWExport.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenMWExport.py b/OpenMWExport.py index 9337ec7..a57b813 100644 --- a/OpenMWExport.py +++ b/OpenMWExport.py @@ -101,6 +101,12 @@ def display(self): return # Clear out the existing data= and content= lines from openmw.cfg self.__clearOpenMWConfig(configPath) + # get already enabled groundcover plugins + existing_groundcovers = set() + with configPath.open("r", encoding="utf-8") as openmwcfg: + for line in openmwcfg: + if line.lower().startswith("groundcover="): + existing_groundcovers.add(line.strip().split('=')[1].lower()) with configPath.open("a", encoding="utf-8") as openmwcfg: # write out data directories openmwcfg.write(self.__processDataPath(game.dataDirectory().absolutePath())) @@ -117,7 +123,9 @@ def display(self): loadOrder[loadIndex] = plugin # actually write out the list for pluginIndex in range(len(loadOrder)): - openmwcfg.write("content=" + loadOrder[pluginIndex] + "\n") + pluginName = loadOrder[pluginIndex] + if pluginName.lower() not in existing_groundcovers: + openmwcfg.write("content=" + pluginName + "\n") QMessageBox.information(self._parentWidget(), OpenMWExportPlugin.tr("OpenMW Export Complete"), OpenMWExportPlugin.tr("The export to OpenMW completed successfully. The current setup was saved to {0}").format(configPath)) @staticmethod