File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """
2+ paths.py
3+ --------
4+ Cross-platform storage path resolver for SchedPlus.
5+
6+ This module defines where persistent data is stored, including:
7+ - SQLite database file
8+ - Legacy JSON file (for migration)
9+ """
10+
11+ import os
12+ from appdirs import user_data_dir
13+
14+
15+ APP_NAME = "SchedPlus"
16+ APP_AUTHOR = "ZFordDev" # optional, used on Windows
17+
18+
19+ def resolve_storage_dir () -> str :
20+ """
21+ Returns the directory where SchedPlus stores all persistent data.
22+ Creates the directory if it does not exist.
23+ """
24+ path = user_data_dir (APP_NAME , APP_AUTHOR )
25+
26+ if not os .path .exists (path ):
27+ os .makedirs (path , exist_ok = True )
28+
29+ return path
30+
31+
32+ def get_db_path () -> str :
33+ """
34+ Returns the full path to the SQLite database file.
35+ """
36+ return os .path .join (resolve_storage_dir (), "schedplus.db" )
37+
38+
39+ def get_json_path () -> str :
40+ """
41+ Returns the full path to the legacy JSON file (for migration).
42+ """
43+ return os .path .join (resolve_storage_dir (), "tasks.json" )
You can’t perform that action at this time.
0 commit comments