diff --git a/rewind/paths.py b/rewind/paths.py index 6d4987b..b21e052 100644 --- a/rewind/paths.py +++ b/rewind/paths.py @@ -6,7 +6,6 @@ from importlib import resources APP_NAME = "rewind" CONFIG_NAME = "config.toml" -STATE_NAME = "state.json" def get_config_dir() -> Path: base = os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config") @@ -25,4 +24,9 @@ def load_config() -> dict: with config_file.open("rb") as f: return tomllib.load(f) - + +def get_state_dir() -> Path: + base = os.path.expanduser("~/.local/share") + path = Path(base) / APP_NAME + path.mkdir(parents=True, exist_ok=True) + return path \ No newline at end of file diff --git a/rewind/state.py b/rewind/state.py index eea84ed..74f8ec4 100644 --- a/rewind/state.py +++ b/rewind/state.py @@ -4,18 +4,12 @@ import json import os from pathlib import Path +from rewind.paths import get_state_dir -APP_NAME = "rewind" STATE_NAME = "state.json" -def state_dir() -> Path: - base = os.path.expanduser("~/.local/share") - path = Path(base) / APP_NAME - path.mkdir(parents=True, exist_ok=True) - return path - def get_state_file_path() -> Path: - return state_dir() / STATE_NAME + return get_state_dir() / STATE_NAME def load_state() -> dict: if not get_state_file_path().exists():