1
0
Fork 0
mirror of synced 2024-06-17 18:14:44 +12:00

fix error when no config file

This commit is contained in:
ChemicalXandco 2021-01-17 22:27:25 +00:00
parent a47cc114b6
commit 59bc4c0dd6
2 changed files with 11 additions and 12 deletions

7
.gitignore vendored
View file

@ -1,8 +1,11 @@
# python
*.pyc
*.pyo
__pycache__
/images/
/.idea/
/Rare/__pycache__/
/Scripts/CountLines.sh
*/__pycache__/
/build/
/dist/
/Rare.egg-info/

View file

@ -1,17 +1,13 @@
import configparser
import os
from legendary.lfs.lgndry import LGDLFS
config_path = os.path.expanduser("~") + "/.config/legendary/"
lgd_config = configparser.ConfigParser()
lgd_config.optionxform = str
lgd = LGDLFS()
def get_config() -> {}:
lgd_config.read(config_path + "config.ini")
lgd_config.optionxform = str
return lgd_config
return lgd.config
def set_config(new_config: {}):
lgd_config = new_config
lgd_config.write(open(config_path + "config.ini", "w"))
lgd.config = new_config
with open(os.path.join(lgd.path, 'config.ini'), "w") as cf:
lgd.config.write(cf)