MCPcopy Index your code
hub / github.com/encounter/objdiff / try_project_config

Function try_project_config

objdiff-core/src/config/mod.rs:246–272  ·  view source on GitHub ↗
(
    dir: &std::path::Path,
)

Source from the content-addressed store, hash-verified

244
245#[cfg(feature = "std")]
246pub fn try_project_config(
247 dir: &std::path::Path,
248) -> Option<(Result<ProjectConfig>, ProjectConfigInfo)> {
249 for filename in CONFIG_FILENAMES.iter() {
250 let config_path = dir.join(filename);
251 let Ok(file) = std::fs::File::open(&config_path) else {
252 continue;
253 };
254 let metadata = file.metadata();
255 if let Ok(metadata) = metadata {
256 if !metadata.is_file() {
257 continue;
258 }
259 let ts = filetime::FileTime::from_last_modification_time(&metadata);
260 let mut reader = std::io::BufReader::new(file);
261 let mut result = read_json_config(&mut reader);
262 if let Ok(config) = &result {
263 // Validate min_version if present
264 if let Err(e) = validate_min_version(config) {
265 result = Err(e);
266 }
267 }
268 return Some((result, ProjectConfigInfo { path: config_path, timestamp: Some(ts) }));
269 }
270 }
271 None
272}
273
274#[cfg(feature = "std")]
275pub fn save_project_config(

Callers 3

load_project_configFunction · 0.85
generateFunction · 0.85
runFunction · 0.85

Calls 2

read_json_configFunction · 0.85
validate_min_versionFunction · 0.85

Tested by

no test coverage detected