MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / save

Method save

atomic-config/src/lib.rs:1089–1103  ·  view source on GitHub ↗

Save global configuration to the default location

(&self)

Source from the content-addressed store, hash-verified

1087
1088 /// Save global configuration to the default location
1089 pub fn save(&self) -> Result<(), ConfigError> {
1090 let path = global_config_path().ok_or(ConfigError::NoConfigDir)?;
1091
1092 if let Some(parent) = path.parent() {
1093 std::fs::create_dir_all(parent).map_err(|e| ConfigError::WriteError {
1094 path: parent.to_path_buf(),
1095 source: e,
1096 })?;
1097 }
1098
1099 let content = toml::to_string_pretty(self)?;
1100 std::fs::write(&path, content).map_err(|e| ConfigError::WriteError { path, source: e })?;
1101
1102 Ok(())
1103 }
1104}
1105
1106impl RepoConfig {

Calls 7

global_config_pathFunction · 0.85
parentMethod · 0.80
writeFunction · 0.50
openMethod · 0.45
writeMethod · 0.45
cloneMethod · 0.45
as_bytesMethod · 0.45