summaryrefslogtreecommitdiff
path: root/src/config.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-10-16 18:49:32 +0200
committermathieui <mathieui@mathieui.net>2014-10-16 18:56:12 +0200
commita9f642f7438fe4489cdb9cc5ac59c929054656c8 (patch)
tree5ce6cba2105f178f92235fa325725941a5c9924c /src/config.py
parentd4590949f7b691e3e1d6eff8fa339e62a44bae51 (diff)
downloadpoezio-a9f642f7438fe4489cdb9cc5ac59c929054656c8.tar.gz
poezio-a9f642f7438fe4489cdb9cc5ac59c929054656c8.tar.bz2
poezio-a9f642f7438fe4489cdb9cc5ac59c929054656c8.tar.xz
poezio-a9f642f7438fe4489cdb9cc5ac59c929054656c8.zip
Extract XHTML-IM inline imags by default
- Add two new options: tmp_image_dir and extract_inline_images - tmp_image_dir is $XDG_CACHE_HOME(usually ~/.cache)/poezio/images if unset - Name the images from a SHA-1 of their data and their mimetype - Output file:// links inside the message
Diffstat (limited to 'src/config.py')
-rw-r--r--src/config.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/config.py b/src/config.py
index 354c3447..5bd1ac17 100644
--- a/src/config.py
+++ b/src/config.py
@@ -361,7 +361,6 @@ def file_ok(filepath):
def check_create_config_dir():
"""
create the configuration directory if it doesn't exist
- and copy the default config in it
"""
CONFIG_HOME = environ.get("XDG_CONFIG_HOME")
if not CONFIG_HOME:
@@ -374,6 +373,23 @@ def check_create_config_dir():
pass
return CONFIG_PATH
+def check_create_cache_dir():
+ """
+ create the cache directory if it doesn't exist
+ also create the subdirectories
+ """
+ global CACHE_DIR
+ CACHE_HOME = environ.get("XDG_CACHE_HOME")
+ if not CACHE_HOME:
+ CACHE_HOME = path.join(environ.get('HOME'), '.cache')
+ CACHE_DIR = path.join(CACHE_HOME, 'poezio')
+
+ try:
+ makedirs(CACHE_DIR)
+ makedirs(path.join(CACHE_DIR, 'images'))
+ except OSError:
+ pass
+
def run_cmdline_args(CONFIG_PATH):
"Parse the command line arguments"
global options
@@ -495,3 +511,6 @@ safeJID = None
# the global log dir
LOG_DIR = ''
+
+# the global cache dir
+CACHE_DIR = ''