2020-06-04 17:16:51 +00:00
|
|
|
import logging
|
2020-06-03 17:41:30 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import appdirs
|
|
|
|
|
2020-06-06 00:00:16 +00:00
|
|
|
log = logging.getLogger("tuxbot.core.data_manager")
|
2020-06-04 17:16:51 +00:00
|
|
|
|
2020-06-03 17:41:30 +00:00
|
|
|
app_dir = appdirs.AppDirs("Tuxbot-bot")
|
|
|
|
config_dir = Path(app_dir.user_config_dir)
|
2020-09-01 22:08:06 +00:00
|
|
|
config_file = config_dir / "config.yaml"
|
2020-06-03 17:41:30 +00:00
|
|
|
|
|
|
|
|
2020-06-04 14:36:22 +00:00
|
|
|
def data_path(instance_name: str) -> Path:
|
2020-06-03 22:46:53 +00:00
|
|
|
"""Return Path for data configs.
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
----------
|
|
|
|
instance_name:str
|
|
|
|
|
|
|
|
Returns
|
|
|
|
-------
|
|
|
|
Path
|
|
|
|
Generated path for data configs.
|
|
|
|
"""
|
2020-06-03 17:41:30 +00:00
|
|
|
return Path(app_dir.user_data_dir) / "data" / instance_name
|
|
|
|
|
|
|
|
|
2020-06-04 22:29:14 +00:00
|
|
|
def logs_data_path(instance_name: str) -> Path:
|
|
|
|
"""Return Path for logs.
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
----------
|
|
|
|
instance_name:str
|
|
|
|
|
|
|
|
Returns
|
|
|
|
-------
|
|
|
|
Path
|
|
|
|
Generated path for logs files.
|
|
|
|
"""
|
2020-06-11 17:43:00 +00:00
|
|
|
return data_path(instance_name) / "logs"
|