elph-core 0.0.4

Shared core utilities for Elph applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::fs::write_json_file;
use crate::utils::path::AppPaths;
use anyhow::Result;

pub struct TrustStore;

impl TrustStore {
    pub fn ensure<P: AppPaths>(paths: &P) -> Result<()> {
        let path = paths.trust_path();
        if path.exists() {
            return Ok(());
        }

        write_json_file(&path, &serde_json::json!({}))?;
        Ok(())
    }
}