From ef7592ca2988ffc70567badfafa2b5238e814eab Mon Sep 17 00:00:00 2001 From: httphypixelnet <91695346+httphypixelnet@users.noreply.github.com> Date: Sun, 20 Jul 2025 19:53:57 -0700 Subject: [PATCH] fix unnecessary code in mod.rs --- packages/core/src/api/java/mod.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/core/src/api/java/mod.rs b/packages/core/src/api/java/mod.rs index 7384121e..ed990728 100644 --- a/packages/core/src/api/java/mod.rs +++ b/packages/core/src/api/java/mod.rs @@ -201,16 +201,11 @@ fn find_java_in_path(mut found: Vec) -> Vec { for path_entry in path.split(':') { let java = PathBuf::from(path_entry).join("java"); if java.exists() { - if let Some(bin_dir) = java.parent() { - if let Some(java_home) = bin_dir.parent() { - let java_home_path = java_home.to_path_buf(); - // java executable should always be under bin/java of root - let java_path = java_home_path.join("bin").join("java"); - if !found.contains(&java_path) { - found.push(java_path); - } - } - } + if java.is_file() { + if !found.contains(&java) { + found.push(java); + } + } } } } @@ -321,7 +316,7 @@ fn internal_locate_java() -> Vec { } - find_java_in_path(found); + found = find_java_in_path(found); found } @@ -359,7 +354,7 @@ fn internal_locate_java() -> Vec { // check env vars // woowoooo mutation - let found = find_java_in_path(found); + found = find_java_in_path(found); found }