- Remove unused chrono and uuid dependencies from kon-storage - Add schema versioning TODO to run_migrations() for pre-release safety - Add doc comment and usage example to log_error() (uncalled public API) - Add TODO to consolidate app_data_dir() with model_manager::dirs_path() - Add safety comments and #[allow(deprecated)] to keystore set_var usage - Add TODO for keyring crate migration in cloud-providers keystore - Apply cargo fmt Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
902 B
Rust
29 lines
902 B
Rust
use std::path::PathBuf;
|
|
|
|
/// Resolve the app data directory.
|
|
/// Windows: %LOCALAPPDATA%/kon
|
|
/// Unix: ~/.kon
|
|
///
|
|
/// TODO: Consolidate with `crates/transcription/src/model_manager.rs::dirs_path()`
|
|
/// into a shared helper in `crates/core/` to avoid duplicating platform-specific
|
|
/// path logic across crates.
|
|
pub fn app_data_dir() -> PathBuf {
|
|
if cfg!(target_os = "windows") {
|
|
let local_app_data = std::env::var("LOCALAPPDATA").unwrap_or_else(|_| ".".to_string());
|
|
PathBuf::from(local_app_data).join("kon")
|
|
} else {
|
|
let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string());
|
|
PathBuf::from(home).join(".kon")
|
|
}
|
|
}
|
|
|
|
/// Path to the SQLite database file.
|
|
pub fn database_path() -> PathBuf {
|
|
app_data_dir().join("kon.db")
|
|
}
|
|
|
|
/// Directory for saved audio recordings.
|
|
pub fn recordings_dir() -> PathBuf {
|
|
app_data_dir().join("recordings")
|
|
}
|