mirror of
https://github.com/derrod/legendary.git
synced 2025-01-03 04:45:28 +00:00
[cli/utils] Automatically create missing config sections
This commit is contained in:
parent
0416b472d3
commit
4d5539c889
|
@ -598,8 +598,6 @@ class LegendaryCLI:
|
|||
config_tags = self.core.lgd.config.get(game.app_name, 'install_tags', fallback=None)
|
||||
if not self.core.is_installed(game.app_name) or config_tags is None or args.reset_sdl:
|
||||
args.install_tag = sdl_prompt(sdl_name, game.app_title)
|
||||
if game.app_name not in self.core.lgd.config:
|
||||
self.core.lgd.config[game.app_name] = dict()
|
||||
self.core.lgd.config.set(game.app_name, 'install_tags', ','.join(args.install_tag))
|
||||
else:
|
||||
args.install_tag = config_tags.split(',')
|
||||
|
|
|
@ -1152,8 +1152,6 @@ class LegendaryCore:
|
|||
|
||||
# transfer install tag choices to config
|
||||
if lgd_igame.install_tags:
|
||||
if app_name not in self.lgd.config:
|
||||
self.lgd.config[app_name] = dict()
|
||||
self.lgd.config.set(app_name, 'install_tags', ','.join(lgd_igame.install_tags))
|
||||
|
||||
# mark game as installed
|
||||
|
|
|
@ -22,12 +22,16 @@ class LGDConf(configparser.ConfigParser):
|
|||
super().write(*args, **kwargs)
|
||||
self.modtime = int(time.time())
|
||||
|
||||
def set(self, *args, **kwargs):
|
||||
def set(self, section, option, value=None):
|
||||
if self.read_only:
|
||||
return
|
||||
|
||||
# ensure config section exists
|
||||
if not self.has_section(section):
|
||||
self.add_section(section)
|
||||
|
||||
self.modified = True
|
||||
super().set(*args, **kwargs)
|
||||
super().set(section, option, value)
|
||||
|
||||
def remove_option(self, section, option):
|
||||
if self.read_only:
|
||||
|
|
Loading…
Reference in a new issue