diff --git a/bin/src/addons.rs b/bin/src/addons.rs index d8962bf6..f89b7e3e 100644 --- a/bin/src/addons.rs +++ b/bin/src/addons.rs @@ -101,6 +101,25 @@ impl Addon { for location in [Location::Addons, Location::Optionals] { addons.extend(location.scan()?); } + for addon in &addons { + if addon.name().to_lowercase() != addon.name() { + warn!( + "Addon name {} is not lowercase, it is highly recommended to use lowercase names", + addon.name() + ); + } + if addons.iter().any(|a| { + a.name().to_lowercase() == addon.name().to_lowercase() && a.name() != addon.name() + }) { + return Err(Error::AddonNameDuplicate(addon.name().to_string())); + } + if addons.iter().any(|a| { + a.name().to_lowercase() == addon.name().to_lowercase() + && a.location() != addon.location() + }) { + return Err(Error::AddonDuplicate(addon.name().to_string())); + } + } Ok(addons) } } diff --git a/bin/src/commands/build.rs b/bin/src/commands/build.rs index bec197bd..78decb4a 100644 --- a/bin/src/commands/build.rs +++ b/bin/src/commands/build.rs @@ -52,7 +52,7 @@ pub fn pre_execute(matches: &ArgMatches) -> Result<(), Error> { let just = matches .get_many::("just") .unwrap_or_default() - .map(std::string::String::as_str) + .map(|s| s.to_lowercase()) .collect::>(); let mut ctx = Context::new( std::env::current_dir()?, @@ -65,7 +65,7 @@ pub fn pre_execute(matches: &ArgMatches) -> Result<(), Error> { }, )?; if !just.is_empty() { - ctx = ctx.filter(|a, _| just.contains(&a.name())); + ctx = ctx.filter(|a, _| just.contains(&a.name().to_lowercase())); } let mut executor = Executor::new(&ctx); diff --git a/bin/src/commands/dev.rs b/bin/src/commands/dev.rs index 3daf8a6d..b5f498eb 100644 --- a/bin/src/commands/dev.rs +++ b/bin/src/commands/dev.rs @@ -59,7 +59,7 @@ pub fn execute(matches: &ArgMatches, launch_optionals: &[String]) -> Result("just") .unwrap_or_default() - .map(std::string::String::as_str) + .map(|s| s.to_lowercase()) .collect::>(); let ctx = Context::new( @@ -73,7 +73,7 @@ pub fn execute(matches: &ArgMatches, launch_optionals: &[String]) -> Result