--- name: Storage file paths type: architecture-map-page slice: 05-core-storage-hotkey-build last_verified: 2026/05/09 --- # Storage file paths > **Where you are:** [Architecture map](../README.md) → [Core, Storage, Hotkey, Build](README.md) → Storage file paths **Plain English summary.** Thin re-export layer. `magnotia-storage::file_storage` proxies the `magnotia-core::paths::AppPaths` accessors so callers that already depend on `magnotia-storage` do not need to add an explicit `magnotia-core` import to reach the database path. ## At a glance - File: `crates/storage/src/file_storage.rs` (28 LOC). - External deps: standard library only. Forwards into `magnotia_core::paths`. - Public surface: `app_data_dir`, `database_path`, `recordings_dir`, `crashes_dir`, `logs_dir`. Re-exported from `crates/storage/src/lib.rs:23`. - Consumers: slice 2 startup; the diagnostic-report bundler; the live-session recorder writing audio to `recordings_dir`. ## What's in here Every function is a one-liner forwarding into the core path API: ```rust pub fn app_data_dir() -> PathBuf { magnotia_core::paths::app_paths().app_data_dir() } pub fn database_path() -> PathBuf { magnotia_core::paths::app_paths().database_path() } pub fn recordings_dir() -> PathBuf { magnotia_core::paths::app_paths().recordings_dir() } pub fn crashes_dir() -> PathBuf { magnotia_core::paths::app_paths().crashes_dir() } pub fn logs_dir() -> PathBuf { magnotia_core::paths::app_paths().logs_dir() } ``` ## Notes per directory - **`database_path`** — `/magnotia.db`. Where `magnotia_storage::init` creates / opens the SQLite database. Absent on first run; created with `create_if_missing(true)`. - **`recordings_dir`** — `/recordings/`. Audio captures live here. The transcription command (slice 2) writes WAV files; their relative path is stamped onto `transcripts.audio_path`. - **`crashes_dir`** — `/crashes/`. The Rust panic hook writes `-.crash` files here. Read by the diagnostic-report bundler in Settings → About. - **`logs_dir`** — `/logs/`. Rolling log file (`magnotia.log`, rotated `magnotia.log.1`, etc). The `tracing-subscriber` set up in slice 2 startup (`src-tauri/src/lib.rs`) writes here. The model directories (`models_dir`, `speech_model_dir`, `llm_models_dir`) are **not re-exported here**. Callers reach them directly via `magnotia_core::paths::AppPaths` — those calls live in slices 3 (speech models) and 4 (LLM models). ## Watch-outs - **No directory-creation side effects.** These functions return paths only. Callers that need the directory to exist are responsible for `std::fs::create_dir_all`. The storage `init` function does this for the database parent (`crates/storage/src/database.rs:10`); other consumers should follow. - **Repeated calls re-resolve env vars.** Each invocation rebuilds `AppPaths` from scratch. Cheap, but noisy. Slice 2 caches a `OnceLock` for the app lifetime. ## See also - [Core app paths](core-paths.md) — the underlying `AppPaths` type. - [Storage overview](storage-overview.md)