summaryrefslogtreecommitdiff
path: root/poezio/config.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-04 11:42:04 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-04 12:07:31 +0200
commitda12fe7d6aa9ee9a710e914185a45f843180e42e (patch)
tree5f573f8b3eef50cf27114f3c2d0eebd90e2d9e4e /poezio/config.py
parent7978481edf172fa6d308932a640e1a9bccdd0d4f (diff)
downloadpoezio-da12fe7d6aa9ee9a710e914185a45f843180e42e.tar.gz
poezio-da12fe7d6aa9ee9a710e914185a45f843180e42e.tar.bz2
poezio-da12fe7d6aa9ee9a710e914185a45f843180e42e.tar.xz
poezio-da12fe7d6aa9ee9a710e914185a45f843180e42e.zip
Move XDG basedir functions to the poezio.xdg module.
Diffstat (limited to 'poezio/config.py')
-rw-r--r--poezio/config.py20
1 files changed, 2 insertions, 18 deletions
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():