Support MIRAGE_CACHE_DIR env variable
This commit is contained in:
parent
d4350f6e86
commit
451abfdf25
10
README.md
10
README.md
@ -73,11 +73,15 @@ or *~/.config/mirage/settings.json*.
|
|||||||
For Flatpak users, this will be
|
For Flatpak users, this will be
|
||||||
*~/.var/app/io.github.mirukana.mirage/config/mirage* instead.
|
*~/.var/app/io.github.mirukana.mirage/config/mirage* instead.
|
||||||
|
|
||||||
The config folder where *settings.json* is located can be overriden by
|
The config folder where *accounts.json* and *settings.json* is located can be
|
||||||
setting the `MIRAGE_CONFIG_DIR` environment variable.
|
overriden by setting the `MIRAGE_CONFIG_DIR` environment variable.
|
||||||
The user data folder where *themes*, saved encryption data and other files
|
|
||||||
|
The user data folder where *themes*, encryption data and interface states
|
||||||
are saved can be overriden with `MIRAGE_DATA_DIR`.
|
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 `theme` setting can be:
|
||||||
|
|
||||||
- The filename of a built-in theme (`Midnight.qpl` or `Glass.qpl`)
|
- The filename of a built-in theme (`Midnight.qpl` or `Glass.qpl`)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging as log
|
import logging as log
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -102,7 +103,10 @@ class Backend:
|
|||||||
self.send_locks: DefaultDict[str, asyncio.Lock] = \
|
self.send_locks: DefaultDict[str, asyncio.Lock] = \
|
||||||
DefaultDict(asyncio.Lock) # {room_id: 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)
|
self.media_cache: MediaCache = MediaCache(self, cache_dir)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user