mirror of
https://github.com/ModOrganizer2/modorganizer-basic_games.git
synced 2026-07-27 14:07:29 -07:00
Create blank INI files if the source INI file does not exist
This commit is contained in:
+8
-4
@@ -1,5 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from pathlib import Path
|
||||
@@ -435,10 +436,13 @@ class BasicGame(mobase.IPluginGame):
|
||||
def initializeProfile(self, path: QDir, settings: int):
|
||||
if settings & mobase.ProfileSetting.CONFIGURATION:
|
||||
for iniFile in self.iniFiles():
|
||||
shutil.copyfile(
|
||||
self.documentsDirectory().absoluteFilePath(iniFile),
|
||||
path.absoluteFilePath(QFileInfo(iniFile).fileName()),
|
||||
)
|
||||
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
|
||||
|
||||
def primarySources(self):
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user