use crate::GlobalsFinal;
use anyhow::Result as AResult;
use serde::Deserialize;
use std::path::{Path, PathBuf};
#[derive(Deserialize)]
struct Config {
snapshot: ModConfig,
}
#[derive(Deserialize)]
pub(super) struct ModConfig {
template: Option<PathBuf>,
}
impl ModConfig {
pub(super) fn new(globals: &GlobalsFinal) -> AResult<Self> {
let cfg: Config = toml::from_str(globals.text())?;
Ok(cfg.snapshot)
}
#[inline]
pub(super) fn template(&self) -> Option<&Path> {
self.template.as_deref()
}
}