Move configuration file to XDG directory (~/.config/qweechat/qweechat.conf)
This commit is contained in:
parent
b9c2b1c910
commit
72c425baea
@ -46,7 +46,7 @@ In QWeeChat, click on connect and enter fields:
|
|||||||
- `port`: the relay port (defined in WeeChat)
|
- `port`: the relay port (defined in WeeChat)
|
||||||
- `password`: the relay password (defined in WeeChat)
|
- `password`: the relay password (defined in WeeChat)
|
||||||
|
|
||||||
Options can be changed in file `~/.qweechat/qweechat.conf`.
|
Options can be changed in file `~/.config/qweechat/qweechat.conf`.
|
||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# config.py - configuration for QWeeChat (~/.qweechat/qweechat.conf)
|
# config.py - configuration for QWeeChat
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011-2021 Sébastien Helleu <flashcode@flashtux.org>
|
# Copyright (C) 2011-2021 Sébastien Helleu <flashcode@flashtux.org>
|
||||||
#
|
#
|
||||||
@ -25,7 +25,9 @@
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
|
|
||||||
CONFIG_DIR = '%s/.qweechat' % os.getenv('HOME')
|
from pathlib import Path
|
||||||
|
|
||||||
|
CONFIG_DIR = '%s/.config/qweechat' % os.getenv('HOME')
|
||||||
CONFIG_FILENAME = '%s/qweechat.conf' % CONFIG_DIR
|
CONFIG_FILENAME = '%s/qweechat.conf' % CONFIG_DIR
|
||||||
|
|
||||||
CONFIG_DEFAULT_RELAY_LINES = 50
|
CONFIG_DEFAULT_RELAY_LINES = 50
|
||||||
@ -123,8 +125,7 @@ def read():
|
|||||||
|
|
||||||
def write(config):
|
def write(config):
|
||||||
"""Write config file."""
|
"""Write config file."""
|
||||||
if not os.path.exists(CONFIG_DIR):
|
Path(CONFIG_DIR).mkdir(mode=0o0700, parents=True, exist_ok=True)
|
||||||
os.mkdir(CONFIG_DIR, 0o0755)
|
|
||||||
with open(CONFIG_FILENAME, 'w') as cfg:
|
with open(CONFIG_FILENAME, 'w') as cfg:
|
||||||
config.write(cfg)
|
config.write(cfg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user