use crate::prelude::internal::*;
impl GtpConfig {
pub fn save(&self, path: &GtpCwdRelativeOrAbsoluteStringPath) -> Result<()> {
let path: GtpCwdRelativePath = path.try_into()?;
let path = path.to_path_buf();
let file = if path.is_dir() {
unimplemented!()
} else if path.ends_with(GTCONFIG_FILE) {
path.to_path_buf()
} else {
unimplemented!()
};
fs::write(&file, self.to_toml_str_pruned()?)
.map_err(|_| GtpConfigError::FailedSaveConfig(file.display().to_string()))
.into_diagnostic()?;
Ok(())
}
}