mirror of
https://github.com/ModOrganizer2/modorganizer-basic_games.git
synced 2026-07-27 14:07:29 -07:00
Move missing INI fix to KCD plugin instead
This commit is contained in:
+4
-8
@@ -1,6 +1,5 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from pathlib import Path
|
||||
@@ -436,13 +435,10 @@ class BasicGame(mobase.IPluginGame):
|
||||
def initializeProfile(self, path: QDir, settings: int):
|
||||
if settings & mobase.ProfileSetting.CONFIGURATION:
|
||||
for iniFile in self.iniFiles():
|
||||
inPath = self.documentsDirectory().absoluteFilePath(iniFile)
|
||||
outPath = path.absoluteFilePath(QFileInfo(iniFile).fileName())
|
||||
if os.path.exists(inPath):
|
||||
shutil.copyfile(inPath, outPath)
|
||||
else:
|
||||
with open(outPath, "w") as _:
|
||||
pass
|
||||
shutil.copyfile(
|
||||
self.documentsDirectory().absoluteFilePath(iniFile),
|
||||
path.absoluteFilePath(QFileInfo(iniFile).fileName()),
|
||||
)
|
||||
|
||||
def primarySources(self):
|
||||
return []
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
from ..basic_game import BasicGame
|
||||
|
||||
import os
|
||||
from PyQt5.QtCore import QDir
|
||||
|
||||
|
||||
class KingdomComeDeliveranceGame(BasicGame):
|
||||
Name = "Kingdom Come Deliverance Support Plugin"
|
||||
@@ -22,3 +25,18 @@ class KingdomComeDeliveranceGame(BasicGame):
|
||||
|
||||
def iniFiles(self):
|
||||
return ["custom.cfg", "system.cfg", "user.cfg"]
|
||||
|
||||
def initializeProfile(self, path: QDir, settings: int):
|
||||
# Create .cfg files if they don't exist
|
||||
for iniFile in self.iniFiles():
|
||||
iniPath = self.documentsDirectory().absoluteFilePath(iniFile)
|
||||
if not os.path.exists(iniPath):
|
||||
with open(iniPath, "w") as _:
|
||||
pass
|
||||
|
||||
# Create the mods directory if it doesn't exist
|
||||
modsPath = self.dataDirectory().absolutePath()
|
||||
if not os.path.exists(modsPath):
|
||||
os.mkdir(modsPath)
|
||||
|
||||
super(KingdomComeDeliveranceGame, self).initializeProfile(path, settings)
|
||||
|
||||
Reference in New Issue
Block a user