Skip to content

Commit

Permalink
fix: improve configuration path handling
Browse files Browse the repository at this point in the history
This change modifies the way configuration paths are handled by creating the XDG configuration directory if it does not exist, ensuring that the application can properly utilize the XDG configuration path.
  • Loading branch information
versun committed Dec 31, 2024
1 parent 5cf78b5 commit 86149db
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aicmt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ def _get_config_paths() -> Optional[str]:
1. Local configuration (./.aicmtrc)
2. XDG configuration ($XDG_CONFIG_HOME/aicmt/.aicmtrc or ~/.config/aicmt/.aicmtrc)
"""

xdg_config_path = _get_xdg_config_home() / "aicmt"
config_path = [
Path.cwd() / ".aicmtrc", # Local config
_get_xdg_config_home() / "aicmt" / ".aicmtrc", # XDG config
xdg_config_path / ".aicmtrc", # XDG config
Path.home() / ".aicmtrc", # Legacy global config
]

xdg_config_path.mkdir(parents=True, exist_ok=True)

for path in config_path:
if path.is_file():
return path
Expand Down

0 comments on commit 86149db

Please sign in to comment.