summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/config.py23
-rw-r--r--poezio/connection.py5
-rw-r--r--poezio/core/core.py6
-rw-r--r--poezio/poezio.py1
4 files changed, 6 insertions, 29 deletions
diff --git a/poezio/config.py b/poezio/config.py
index 5b99b293..127f37c2 100644
--- a/poezio/config.py
+++ b/poezio/config.py
@@ -516,26 +516,6 @@ def get_image_cache():
return xdg.CACHE_HOME / 'images'
-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 cache_home is None or not Path(cache_home).is_absolute():
- cache_home = path.join(environ.get('HOME'), '.cache')
- CACHE_DIR = path.join(cache_home, 'poezio')
-
- try:
- makedirs(CACHE_DIR)
- makedirs(path.join(CACHE_DIR, 'avatars'))
- makedirs(path.join(CACHE_DIR, 'images'))
- makedirs(path.join(CACHE_DIR, 'caps'))
- except OSError:
- pass
-
-
def check_config():
"""
Check the config file and print results
@@ -725,6 +705,3 @@ DATA_DIR = ''
# the global log dir
LOG_DIR = ''
-
-# the global cache dir
-CACHE_DIR = ''
diff --git a/poezio/connection.py b/poezio/connection.py
index c97365f8..0cbff1a5 100644
--- a/poezio/connection.py
+++ b/poezio/connection.py
@@ -25,8 +25,9 @@ from slixmpp.util import FileSystemCache
from poezio import common
from poezio import fixes
+from poezio import xdg
from poezio.common import safeJID
-from poezio.config import config, options, CACHE_DIR
+from poezio.config import config, options
class Connection(slixmpp.ClientXMPP):
@@ -120,7 +121,7 @@ class Connection(slixmpp.ClientXMPP):
# Must be loaded before 0030.
self.register_plugin('xep_0115', {
'caps_node': 'https://poez.io',
- 'cache': FileSystemCache(CACHE_DIR, 'caps', encode=str,
+ 'cache': FileSystemCache(xdg.CACHE_HOME, 'caps', encode=str,
decode=lambda x: DiscoInfo(ET.fromstring(x))),
})
self.register_plugin('xep_0030')
diff --git a/poezio/core/core.py b/poezio/core/core.py
index e24335fb..37bf7752 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -31,7 +31,7 @@ from poezio import windows
from poezio.bookmarks import BookmarkList
from poezio.common import safeJID
-from poezio.config import config, firstrun, CACHE_DIR
+from poezio.config import config, firstrun
from poezio.contact import Contact, Resource
from poezio.daemon import Executor
from poezio.fifo import Fifo
@@ -41,7 +41,7 @@ from poezio.roster import roster
from poezio.size_manager import SizeManager
from poezio.text_buffer import TextBuffer
from poezio.theming import get_theme
-from poezio import keyboard
+from poezio import keyboard, xdg
from poezio.core.completions import CompletionCore
from poezio.core.commands import CommandCore
@@ -77,7 +77,7 @@ class Core(object):
self.bookmarks = BookmarkList()
self.debug = False
self.remote_fifo = None
- self.avatar_cache = FileSystemPerJidCache(CACHE_DIR, 'avatars', binary=True)
+ self.avatar_cache = FileSystemPerJidCache(xdg.CACHE_HOME, 'avatars', binary=True)
# a unique buffer used to store global information
# that are displayed in almost all tabs, in an
# information window.
diff --git a/poezio/poezio.py b/poezio/poezio.py
index ee6cd6db..1e6a5143 100644
--- a/poezio/poezio.py
+++ b/poezio/poezio.py
@@ -81,7 +81,6 @@ def main():
config.create_global_config()
config.check_create_data_dir()
config.check_create_log_dir()
- config.check_create_cache_dir()
config.setup_logging()
config.post_logging_setup()