Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions nonebot_plugin_localstore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,29 @@

APP_NAME = "nonebot2"
BASE_CACHE_DIR = (
user_cache_dir(APP_NAME).resolve()
(
(Path.cwd() / "cache")
if plugin_config.localstore_use_cwd
else user_cache_dir(APP_NAME).resolve()
)
if plugin_config.localstore_cache_dir is None
else plugin_config.localstore_cache_dir.resolve()
)
BASE_CONFIG_DIR = (
user_config_dir(APP_NAME).resolve()
(
(Path.cwd() / "config")
if plugin_config.localstore_use_cwd
else user_config_dir(APP_NAME).resolve()
)
if plugin_config.localstore_config_dir is None
else plugin_config.localstore_config_dir.resolve()
)
BASE_DATA_DIR = (
user_data_dir(APP_NAME).resolve()
(
(Path.cwd() / "data")
if plugin_config.localstore_use_cwd
else user_data_dir(APP_NAME).resolve()
)
if plugin_config.localstore_data_dir is None
else plugin_config.localstore_data_dir.resolve()
)
Expand Down
1 change: 1 addition & 0 deletions nonebot_plugin_localstore/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


class Config(BaseModel):
localstore_use_cwd: bool = False
localstore_cache_dir: Optional[Path] = None
localstore_config_dir: Optional[Path] = None
localstore_data_dir: Optional[Path] = None
Expand Down