fix error when no config file
This commit is contained in:
parent
a47cc114b6
commit
59bc4c0dd6
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,8 +1,11 @@
|
|||
# python
|
||||
*.pyc
|
||||
*.pyo
|
||||
__pycache__
|
||||
|
||||
/images/
|
||||
/.idea/
|
||||
/Rare/__pycache__/
|
||||
/Scripts/CountLines.sh
|
||||
*/__pycache__/
|
||||
/build/
|
||||
/dist/
|
||||
/Rare.egg-info/
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue