diff --git a/README.md b/README.md index 39057ebb..df8dcdb7 100644 --- a/README.md +++ b/README.md @@ -73,11 +73,15 @@ or *~/.config/mirage/settings.json*. For Flatpak users, this will be *~/.var/app/io.github.mirukana.mirage/config/mirage* instead. -The config folder where *settings.json* is located can be overriden by -setting the `MIRAGE_CONFIG_DIR` environment variable. -The user data folder where *themes*, saved encryption data and other files +The config folder where *accounts.json* and *settings.json* is located can be +overriden by setting the `MIRAGE_CONFIG_DIR` environment variable. + +The user data folder where *themes*, encryption data and interface states are saved can be overriden with `MIRAGE_DATA_DIR`. +The cache folder where downloaded files and thumbnails are saved can be +overriden with `MIRAGE_CACHE_DIR`. + The `theme` setting can be: - The filename of a built-in theme (`Midnight.qpl` or `Glass.qpl`) diff --git a/src/backend/backend.py b/src/backend/backend.py index 06b12396..c21e4535 100644 --- a/src/backend/backend.py +++ b/src/backend/backend.py @@ -2,6 +2,7 @@ import asyncio import logging as log +import os import sys import traceback from pathlib import Path @@ -102,7 +103,10 @@ class Backend: self.send_locks: DefaultDict[str, asyncio.Lock] = \ DefaultDict(asyncio.Lock) # {room_id: lock} - cache_dir = Path(self.appdirs.user_cache_dir) + cache_dir = Path( + os.environ.get("MIRAGE_CACHE_DIR") or self.appdirs.user_cache_dir, + ) + self.media_cache: MediaCache = MediaCache(self, cache_dir)