Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip plugins that are already listed as groundcover #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion OpenMWExport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand All @@ -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
Expand Down