mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-10 23:23:34 +02:00
Change location of ebook-converter rc files
This commit is contained in:
@@ -77,22 +77,19 @@ plugins = Plugins()
|
|||||||
|
|
||||||
CONFIG_DIR_MODE = 0o700
|
CONFIG_DIR_MODE = 0o700
|
||||||
|
|
||||||
cconfd = os.getenv('CALIBRE_CONFIG_DIRECTORY')
|
|
||||||
if cconfd is not None:
|
|
||||||
config_dir = os.path.abspath(cconfd)
|
|
||||||
|
|
||||||
bdir = os.path.abspath(os.path.expanduser(os.getenv('XDG_CONFIG_HOME',
|
bdir = os.path.abspath(os.path.expanduser(os.getenv('XDG_CONFIG_HOME',
|
||||||
'~/.config')))
|
'~/.config')))
|
||||||
config_dir = os.path.join(bdir, 'calibre')
|
config_dir = os.path.join(bdir, 'ebook-converter')
|
||||||
try:
|
try:
|
||||||
os.makedirs(config_dir, mode=CONFIG_DIR_MODE)
|
os.makedirs(config_dir, mode=CONFIG_DIR_MODE)
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not os.path.exists(config_dir) or \
|
if not os.path.exists(config_dir) or \
|
||||||
not os.access(config_dir, os.W_OK) or not \
|
not os.access(config_dir, os.W_OK) or not \
|
||||||
os.access(config_dir, os.X_OK):
|
os.access(config_dir, os.X_OK):
|
||||||
print('No write acces to', config_dir, 'using a temporary dir instead')
|
print('No write acces to', config_dir, 'using a temporary dir instead')
|
||||||
config_dir = tempfile.mkdtemp(prefix='calibre-config-')
|
config_dir = tempfile.mkdtemp(prefix='ec-config-')
|
||||||
|
|
||||||
def cleanup_cdir():
|
def cleanup_cdir():
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user