From da12fe7d6aa9ee9a710e914185a45f843180e42e Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 4 Jul 2018 11:42:04 +0200 Subject: Move XDG basedir functions to the poezio.xdg module. --- poezio/config.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'poezio/config.py') diff --git a/poezio/config.py b/poezio/config.py index fe60be63..8549df71 100644 --- a/poezio/config.py +++ b/poezio/config.py @@ -23,6 +23,7 @@ from os import environ, makedirs, path, remove from shutil import copy2 from pathlib import Path from poezio.args import parse_args +from poezio import xdg DEFAULT_CONFIG = { 'Poezio': { @@ -506,22 +507,6 @@ def file_ok(filepath): return bool(val) -def get_default_config_dir(): - """ - returns the default configuration directory path - """ - try: - config_home = Path(environ.get('XDG_CONFIG_HOME')) - except TypeError: - # XDG_CONFIG_HOME isn’t defined, fallback to ~/.config - pass - else: - if config_home.is_absolute(): - return config_home / 'poezio' - # HOME has already been checked to be non-None in test_env(). - return Path.home() / '.config' / 'poezio' - - def check_create_cache_dir(): """ create the cache directory if it doesn't exist @@ -578,8 +563,7 @@ def check_config(): def run_cmdline_args(): "Parse the command line arguments" global options - CONFIG_PATH = get_default_config_dir() - options = parse_args(CONFIG_PATH) + options = parse_args(xdg.CONFIG_HOME) # Copy a default file if none exists if not options.filename.is_file(): -- cgit v1.2.3