Skip to content

Commit

Permalink
Make certain comparisons case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
theRookieCoder committed Oct 1, 2024
1 parent 8230ed8 commit e034941
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ async fn actual_main(mut cli_app: Ferium) -> Result<()> {
.await
{
return Err(
if err.to_string() == ferinth::Error::InvalidIDorSlug.to_string() {
if let Some(&ferinth::Error::InvalidIDorSlug) = err.downcast_ref() {
anyhow!("Invalid identifier")
} else {
err
Expand Down
2 changes: 1 addition & 1 deletion src/subcommands/modpack/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn delete(
config
.modpacks
.iter()
.position(|modpack| modpack.name == modpack_name)
.position(|modpack| modpack.name.eq_ignore_ascii_case(&modpack_name))
.context("The modpack name provided does not exist")?
} else {
let modpack_names = config
Expand Down
2 changes: 1 addition & 1 deletion src/subcommands/modpack/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn switch(config: &mut Config, modpack_name: Option<String>) -> Result<()> {
match config
.modpacks
.iter()
.position(|modpack| modpack.name == modpack_name)
.position(|modpack| modpack.name.eq_ignore_ascii_case(&modpack_name))
{
Some(selection) => {
config.active_modpack = selection;
Expand Down
2 changes: 1 addition & 1 deletion src/subcommands/profile/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn switch(config: &mut Config, profile_name: Option<String>) -> Result<()> {
match config
.profiles
.iter()
.position(|profile| profile.name == profile_name)
.position(|profile| profile.name.eq_ignore_ascii_case(&profile_name))
{
Some(selection) => {
config.active_profile = selection;
Expand Down
6 changes: 5 additions & 1 deletion src/subcommands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ pub async fn upgrade(profile: &Profile) -> Result<()> {
for file in read_dir(profile.output_dir.join("user"))? {
let file = file?;
let path = file.path();
if path.is_file() && path.extension().is_some_and(|ext| ext == "jar") {
if path.is_file()
&& path
.extension()
.is_some_and(|ext| ext.eq_ignore_ascii_case("jar"))
{
to_install.push((file.file_name(), path));
}
}
Expand Down

0 comments on commit e034941

Please sign in to comment.