1
0
Fork 0
mirror of synced 2024-06-02 02:34:40 +12:00

RareCore: Init default sections if they are not in the config file.

Fixes: #296
This commit is contained in:
loathingKernel 2023-06-11 13:23:43 +03:00
parent 1f06c87743
commit b2722b6ceb
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD

View file

@ -137,19 +137,18 @@ class RareCore(QObject):
with open(os.path.join(path, "config.ini"), "w") as config_file:
config_file.write("[Legendary]")
self.__core = LegendaryCore()
if "Legendary" not in self.__core.lgd.config.sections():
self.__core.lgd.config.add_section("Legendary")
self.__core.lgd.save_config()
for section in ["Legendary", "default", "default.env"]:
if section not in self.__core.lgd.config.sections():
self.__core.lgd.config.add_section(section)
# workaround if egl sync enabled, but no programdata_path
# programdata_path might be unset if logging in through the browser
if self.__core.egl_sync_enabled:
if self.__core.egl.programdata_path is None:
self.__core.lgd.config.remove_option("Legendary", "egl_sync")
self.__core.lgd.save_config()
else:
if not os.path.exists(self.__core.egl.programdata_path):
self.__core.lgd.config.remove_option("Legendary", "egl_sync")
self.__core.lgd.save_config()
self.__core.lgd.save_config()
return self.__core
def image_manager(self, init: bool = False) -> ImageManager: