From 74824ef9be01fb115578b46d6eeddc1d9bea33dd Mon Sep 17 00:00:00 2001 From: christopher-buss Date: Sun, 29 Jun 2025 15:21:08 +0100 Subject: [PATCH 1/2] feat: add support for mantle.yaml extension - Add fallback support for .yaml extension when .yml not found - Maintain priority: mantle.yml takes precedence over mantle.yaml --- mantle/rbx_mantle/src/config.rs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/mantle/rbx_mantle/src/config.rs b/mantle/rbx_mantle/src/config.rs index e07aadf..b37bbfd 100644 --- a/mantle/rbx_mantle/src/config.rs +++ b/mantle/rbx_mantle/src/config.rs @@ -1188,19 +1188,29 @@ fn parse_project_path(project: Option<&str>) -> Result<(PathBuf, PathBuf), Strin let project = project.unwrap_or("."); let project_path = Path::new(project).to_owned(); - let (project_dir, config_file) = if project_path.is_dir() { - (project_path.clone(), project_path.join("mantle.yml")) + if project_path.is_dir() { + let yml_path = project_path.join("mantle.yml"); + let yaml_path = project_path.join("mantle.yaml"); + + if yml_path.exists() { + return Ok((project_path, yml_path)); + } else if yaml_path.exists() { + return Ok((project_path, yaml_path)); + } else { + return Err(format!( + "No config file found. Looked for mantle.yml and mantle.yaml in {}", + project_path.display() + )); + } } else if project_path.is_file() { - (project_path.parent().unwrap().into(), project_path) + if project_path.exists() { + return Ok((project_path.parent().unwrap().into(), project_path)); + } else { + return Err(format!("Config file {} not found", project_path.display())); + } } else { return Err(format!("Unable to load project path: {}", project)); - }; - - if config_file.exists() { - return Ok((project_dir, config_file)); } - - Err(format!("Config file {} not found", config_file.display())) } fn load_config_file(config_file: &Path) -> Result { From 6b9b4a1bbbde8bd7d03b9413f0fd792390cef5b7 Mon Sep 17 00:00:00 2001 From: christopher-buss Date: Sun, 29 Jun 2025 20:52:16 +0100 Subject: [PATCH 2/2] fix: remove unnecessary return statements in config.rs Removes needless return statements in parse_project_path functionto comply with clippy::needless_return lint. --- mantle/rbx_mantle/src/config.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mantle/rbx_mantle/src/config.rs b/mantle/rbx_mantle/src/config.rs index b37bbfd..bf32452 100644 --- a/mantle/rbx_mantle/src/config.rs +++ b/mantle/rbx_mantle/src/config.rs @@ -1193,23 +1193,23 @@ fn parse_project_path(project: Option<&str>) -> Result<(PathBuf, PathBuf), Strin let yaml_path = project_path.join("mantle.yaml"); if yml_path.exists() { - return Ok((project_path, yml_path)); + Ok((project_path, yml_path)) } else if yaml_path.exists() { - return Ok((project_path, yaml_path)); + Ok((project_path, yaml_path)) } else { - return Err(format!( + Err(format!( "No config file found. Looked for mantle.yml and mantle.yaml in {}", project_path.display() - )); + )) } } else if project_path.is_file() { if project_path.exists() { - return Ok((project_path.parent().unwrap().into(), project_path)); + Ok((project_path.parent().unwrap().into(), project_path)) } else { - return Err(format!("Config file {} not found", project_path.display())); + Err(format!("Config file {} not found", project_path.display())) } } else { - return Err(format!("Unable to load project path: {}", project)); + Err(format!("Unable to load project path: {}", project)) } }