diff --git a/syng/sources/files.py b/syng/sources/files.py index 20450f3..765aa8b 100644 --- a/syng/sources/files.py +++ b/syng/sources/files.py @@ -4,6 +4,7 @@ import asyncio import os from typing import Any, Optional from typing import Tuple +from platformdirs import user_cache_dir from ..entry import Entry from .source import available_sources @@ -20,7 +21,7 @@ class FilesSource(FileBasedSource): source_name = "files" config_schema = FileBasedSource.config_schema | { "dir": (str, "Directory to index", "."), - "index_file": (str, "Index file", "files-index"), + "index_file": (str, "Index file", os.path.join(user_cache_dir("syng"), "files-index")), } def __init__(self, config: dict[str, Any]): diff --git a/syng/sources/s3.py b/syng/sources/s3.py index f817166..66db816 100644 --- a/syng/sources/s3.py +++ b/syng/sources/s3.py @@ -9,6 +9,8 @@ import os from json import dump, load from typing import TYPE_CHECKING, Any, Optional, Tuple, cast +from platformdirs import user_cache_dir + try: from minio import Minio @@ -44,7 +46,7 @@ class S3Source(FileBasedSource): "secure": (bool, "Use SSL", True), "bucket": (str, "Bucket of the s3", ""), "tmp_dir": (str, "Folder for\ntemporary download", "/tmp/syng"), - "index_file": (str, "Index file", "s3-index"), + "index_file": (str, "Index file", os.path.join(user_cache_dir("syng"), "s3-index")), } def __init__(self, config: dict[str, Any]):