INNER CODE UNIT · Rust
path
aannoo/hcom · src/db/mod.rs:189
pub fn path(&self) -> &std::path::Path {
&self.db_path
}
/// Open the hcom database at ~/.hcom/hcom.db with schema migration/compat.
pub fn open() -> Result<Self> {
let hcom_dir = crate::paths::hcom_dir();
crate::paths::ensure_private_directory(&hcom_dir)
.with_context(|| format!("Failed to secure hcom directory: {}", hcom_dir.display()))?;
Self::open_at(&hcom_dir.join("hcom.db"))
}
/// Open the hcom database at a specific path with schema migration/compat.
pub fn open_at(db_path: &std::path::Path) -> Result<Self> {
let mut db = Self::open_raw(db_path)?;
db.ensure_schema()?;
Ok(db)
}