Skip to main content

vein_database/
paths.rs

1use std::path::PathBuf;
2use directories::BaseDirs;
3
4pub struct Paths;
5
6impl Paths {
7    fn base_dirs() -> BaseDirs {
8        BaseDirs::new()
9            .expect("Failed to get base directories")
10    }
11
12    pub fn get_insights_db() -> PathBuf {
13        std::env::var("VEIN_INSIGHTS_DB")
14            .map(PathBuf::from)
15            .unwrap_or_else(|_| Self::base_dirs().data_dir().join("vein/insights"))
16    }
17
18    pub fn get_dialogues_db() -> PathBuf {
19        std::env::var("VEIN_DIALOGUES_DB")
20            .map(PathBuf::from)
21            .unwrap_or_else(|_| Self::base_dirs().data_dir().join("vein/dialogues"))
22    }
23}