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/
|
/images/
|
||||||
/.idea/
|
/.idea/
|
||||||
/Rare/__pycache__/
|
|
||||||
/Scripts/CountLines.sh
|
/Scripts/CountLines.sh
|
||||||
*/__pycache__/
|
|
||||||
/build/
|
/build/
|
||||||
/dist/
|
/dist/
|
||||||
/Rare.egg-info/
|
/Rare.egg-info/
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
|
from legendary.lfs.lgndry import LGDLFS
|
||||||
|
|
||||||
config_path = os.path.expanduser("~") + "/.config/legendary/"
|
lgd = LGDLFS()
|
||||||
lgd_config = configparser.ConfigParser()
|
|
||||||
lgd_config.optionxform = str
|
|
||||||
|
|
||||||
|
|
||||||
def get_config() -> {}:
|
def get_config() -> {}:
|
||||||
lgd_config.read(config_path + "config.ini")
|
return lgd.config
|
||||||
lgd_config.optionxform = str
|
|
||||||
return lgd_config
|
|
||||||
|
|
||||||
|
|
||||||
def set_config(new_config: {}):
|
def set_config(new_config: {}):
|
||||||
lgd_config = new_config
|
lgd.config = new_config
|
||||||
lgd_config.write(open(config_path + "config.ini", "w"))
|
with open(os.path.join(lgd.path, 'config.ini'), "w") as cf:
|
||||||
|
lgd.config.write(cf)
|
||||||
|
|
Loading…
Reference in a new issue