Skip to content

Commit

Permalink
fix geode project check when updating a dependency through the index
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Oct 7, 2023
1 parent e4fd781 commit dff7f55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "geode"
version = "2.6.0"
version = "2.6.1"
authors = ["HJfod <dreadrollmusic@gmail.com>", "Camila314 <ilaca314@gmail.com>", "matcool", "ConfiG <cgytrus@cgyt.ru>"]
edition = "2021"
build = "build.rs"
Expand Down
19 changes: 10 additions & 9 deletions src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ fn clear_cache(dir: &Path) {
}

#[derive(PartialEq)]
#[allow(clippy::large_enum_variant)]
enum Found {
/// No matching dependency found
None,
Expand Down Expand Up @@ -159,7 +160,7 @@ fn find_dependency(
let mut closest_score = 4usize;
let mut found = Found::None;
for dir in if search_recursive {
read_dir_recursive(&dir)?
read_dir_recursive(dir)?
} else {
dir.read_dir()?.map(|d| d.unwrap().path()).collect()
} {
Expand Down Expand Up @@ -213,11 +214,11 @@ pub fn check_dependencies(
.map(|ext|
// If the external is provided as name:version get those, otherwise
// assume it's just the name
if ext.contains(":") {
let mut split = ext.split(":");
if ext.contains(':') {
let mut split = ext.split(':');
let name = split.next().unwrap().to_string();
let ver = split.next().unwrap();
(name, Some(Version::parse(ver.strip_prefix("v").unwrap_or(ver))
(name, Some(Version::parse(ver.strip_prefix('v').unwrap_or(ver))
.nice_unwrap("Invalid version in external {name}")
))
}
Expand Down Expand Up @@ -312,7 +313,7 @@ pub fn check_dependencies(
}
// bad version
match (&found_in_index, &found_in_installed) {
(in_index @ Found::Wrong(ver), _) | (in_index @ _, Found::Wrong(ver)) => {
(in_index @ Found::Wrong(ver), _) | (in_index, Found::Wrong(ver)) => {
info!(
"Version '{ver}' of the mod was found in {}, but it was \
rejected because version '{}' is required by the dependency",
Expand All @@ -328,7 +329,7 @@ pub fn check_dependencies(
}
// misspelled message
match (&found_in_index, &found_in_installed) {
(in_index @ Found::Maybe(m), _) | (in_index @ _, Found::Maybe(m)) => {
(in_index @ Found::Maybe(m), _) | (in_index, Found::Maybe(m)) => {
info!(
"Another mod with a similar ID was found in {}: {m} \
- maybe you misspelled?",
Expand All @@ -343,7 +344,7 @@ pub fn check_dependencies(
}
// not-an-api message
match (&found_in_index, &found_in_installed) {
(in_index @ Found::NotAnApi, _) | (in_index @ _, Found::NotAnApi) => {
(in_index @ Found::NotAnApi, _) | (in_index, Found::NotAnApi) => {
info!(
"A mod with the ID '{}' was found in {}, but it was not marked \
as an API - this may be a mistake; if you are the developer \
Expand Down Expand Up @@ -409,7 +410,7 @@ pub fn check_dependencies(
);
path_to_dep_geode = install_mod(
config, &indx_info.id,
&VersionReq::parse(&format!("=={}", indx_info.version.to_string())).unwrap()
&VersionReq::parse(&format!("={}", indx_info.version)).unwrap()
);
_geode_info = indx_info;
}
Expand All @@ -421,7 +422,7 @@ pub fn check_dependencies(
);
path_to_dep_geode = install_mod(
config, &indx_info.id,
&VersionReq::parse(&format!("={}", indx_info.version.to_string())).unwrap()
&VersionReq::parse(&format!("={}", indx_info.version)).unwrap()
);
_geode_info = indx_info;
}
Expand Down

0 comments on commit dff7f55

Please sign in to comment.