1.2 KiB
1.2 KiB
Functional Spec: Persistence
1. Scope
The application needs to persist user preferences and session state across restarts. The primary use case is remembering the Last Opened Project.
2. Storage Mechanism
- Library:
tauri-plugin-store - File:
store.json(located in the App Data directory). - Keys:
last_project_path: String (Absolute path).- (Future)
theme: String. - (Future)
recent_projects: Array.
3. Startup Logic
- Backend Init:
- Load
store.json. - Read
last_project_path. - Verify path exists and is a directory.
- If valid:
- Update
SessionState. - Return "Project Loaded" status to Frontend on init.
- Update
- If invalid/missing:
- Clear key.
- Remain in
Idlestate.
- Load
4. Frontend Logic
- On Mount:
- Call
get_current_project()command. - If returns path -> Show Workspace.
- If returns null -> Show Selection Screen.
- Call
- On "Open Project":
- After successful open, save path to store.
- On "Close Project":
- Clear
SessionState. - Remove
last_project_pathfrom store. - Show Selection Screen.
- Clear