Skip to content

Commit

Permalink
Merge pull request #328 from sachinsenal0x64/develop
Browse files Browse the repository at this point in the history
🧹 It's easy to manage and neat. Saves it in '/pydoro.ini'  to '/.config/pydoro/pydoro.ini.'
  • Loading branch information
JaDogg authored Feb 13, 2024
2 parents 69da44f + 56c2031 commit d6c7e49
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pydoro/pydoro_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _ini_parse(self):
self._conf["Trigger"]["exit_cmd"] = "[]"

filename = os.environ.get(
"PYDORO_CONFIG_FILE", os.path.expanduser("~/.pydoro.ini")
"PYDORO_CONFIG_FILE", os.path.expanduser("~/.config/pydoro/pydoro.ini")
)

if os.path.exists(filename):
Expand All @@ -95,11 +95,16 @@ def _ini_parse(self):
def _create_default_ini(self, filename):
"""
Creates default ini configuration file
Saves it in '~/.pydoro.ini' or the location specified by PYDORO_CONFIG_FILE environment variable
Saves it in '~/.config/pydoro/pydoro.ini' or the location specified by PYDORO_CONFIG_FILE environment variable
"""

config_dir = os.path.expanduser("~/.config/pydoro")
os.makedirs(config_dir, exist_ok=True)
os.chdir(config_dir)

with open(filename, "w+") as configfile:
self._conf.write(configfile)

def _ini_load(self):
"""
Loads the .ini config file preferences
Expand Down

0 comments on commit d6c7e49

Please sign in to comment.