summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-04 13:07:04 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-04 13:07:04 +0200
commit09dbd9f5f2796da95ad4217ba1bcfc9b36e71c22 (patch)
tree350d26d2d5d7f18deac48993f59c96562aabf6c5
parent046a8650cdcd51e5e7d78b3673ed012cdfc1a1d0 (diff)
downloadpoezio-09dbd9f5f2796da95ad4217ba1bcfc9b36e71c22.tar.gz
poezio-09dbd9f5f2796da95ad4217ba1bcfc9b36e71c22.tar.bz2
poezio-09dbd9f5f2796da95ad4217ba1bcfc9b36e71c22.tar.xz
poezio-09dbd9f5f2796da95ad4217ba1bcfc9b36e71c22.zip
Remove the data_dir option, and replace it with XDG_DATA_HOME.
-rw-r--r--poezio/config.py31
-rw-r--r--poezio/poezio.py1
2 files changed, 2 insertions, 30 deletions
diff --git a/poezio/config.py b/poezio/config.py
index 127f37c2..0bb18beb 100644
--- a/poezio/config.py
+++ b/poezio/config.py
@@ -45,7 +45,6 @@ DEFAULT_CONFIG = {
'create_gaps': False,
'custom_host': '',
'custom_port': '',
- 'data_dir': '',
'default_nick': '',
'deterministic_nick_colors': True,
'device_id': '',
@@ -592,35 +591,12 @@ def create_global_config():
sys.exit(1)
-def check_create_data_dir():
- """Create the poezio data directory if it doesn't exist"""
- global DATA_DIR
- DATA_DIR = config.get('data_dir')
-
- if not DATA_DIR:
- data_home = environ.get('XDG_DATA_HOME')
- if data_home is None or not Path(data_home).is_absolute():
- data_home = path.join(environ.get('HOME'), '.local', 'share')
-
- DATA_DIR = path.join(data_home, 'poezio')
-
- DATA_DIR = path.expanduser(DATA_DIR)
- try:
- makedirs(DATA_DIR)
- except:
- pass
-
-
def check_create_log_dir():
"Create the poezio logging directory if it doesn’t exist"
global LOG_DIR
- LOG_DIR = config.get('log_dir')
- if not LOG_DIR and not DATA_DIR:
- check_create_data_dir()
-
- if not LOG_DIR:
- LOG_DIR = path.join(DATA_DIR, 'logs')
+ LOG_DIR = config.get('log_dir')
+ LOG_DIR = Path(LOG_DIR).expanduser() if LOG_DIR else xdg.DATA_HOME / 'logs'
try:
makedirs(LOG_DIR)
@@ -700,8 +676,5 @@ options = None
# delayed import from common.py
safeJID = None
-# the global data dir
-DATA_DIR = ''
-
# the global log dir
LOG_DIR = ''
diff --git a/poezio/poezio.py b/poezio/poezio.py
index 1e6a5143..0b16b6cd 100644
--- a/poezio/poezio.py
+++ b/poezio/poezio.py
@@ -79,7 +79,6 @@ def main():
from poezio import config
config.run_cmdline_args()
config.create_global_config()
- config.check_create_data_dir()
config.check_create_log_dir()
config.setup_logging()
config.post_logging_setup()