Compiler improvements (#145)

* Initial bug fixes

* fix compile error on non-mac

* Fix even more bugs

* Fix more

* fix more

* fix build

* fix build

* working basic

* removed zip

* working functions

* merge fixes

* fixed loadintg bar bug

* changed to one layer deep

* forge version numbers

* improvements + refactoring

* renamed things to fit plugin

* fixed bugs

* removed println

* overrides dont include mrpack

* merge

* fixes

* fixes

* fixed deletion

* merge errors

* force sync before export

* removed testing

* missed line

* removed console log

* mac error reverted

* incoreclty named helper

* added to new register method

* review changes

* minor changes

* moved create pack

* renamed function

---------

Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Wyatt Verchere
2023-06-28 09:58:58 -07:00
committed by GitHub
parent 47970d932b
commit f52e777379
38 changed files with 1047 additions and 896 deletions

View File

@@ -136,11 +136,9 @@ pub async fn get_all_jre() -> Result<Vec<JavaVersion>, JREError> {
// Iterate over JavaVirtualMachines/(something)/Contents/Home/bin
let base_path = PathBuf::from("/Library/Java/JavaVirtualMachines/");
if let Ok(dir) = std::fs::read_dir(base_path) {
for entry in dir {
if let Ok(entry) = entry {
let entry = entry.path().join("Contents/Home/bin");
jre_paths.insert(entry);
}
for entry in dir.flatten() {
let entry = entry.path().join("Contents/Home/bin");
jre_paths.insert(entry);
}
}
@@ -178,12 +176,10 @@ pub async fn get_all_jre() -> Result<Vec<JavaVersion>, JREError> {
jre_paths.insert(PathBuf::from(&path).join("jre").join("bin"));
jre_paths.insert(PathBuf::from(&path).join("bin"));
if let Ok(dir) = std::fs::read_dir(path) {
for entry in dir {
if let Ok(entry) = entry {
let entry_path = entry.path();
jre_paths.insert(entry_path.join("jre").join("bin"));
jre_paths.insert(entry_path.join("bin"));
}
for entry in dir.flatten() {
let entry_path = entry.path();
jre_paths.insert(entry_path.join("jre").join("bin"));
jre_paths.insert(entry_path.join("bin"));
}
}
}
@@ -209,21 +205,19 @@ async fn get_all_autoinstalled_jre_path() -> Result<HashSet<PathBuf>, JREError>
if base_path.is_dir() {
if let Ok(dir) = std::fs::read_dir(base_path) {
for entry in dir {
if let Ok(entry) = entry {
let file_path = entry.path().join("bin");
for entry in dir.flatten() {
let file_path = entry.path().join("bin");
if let Ok(contents) =
std::fs::read_to_string(file_path.clone())
if let Ok(contents) =
std::fs::read_to_string(file_path.clone())
{
let entry = entry.path().join(contents);
jre_paths.insert(entry);
} else {
#[cfg(not(target_os = "macos"))]
{
let entry = entry.path().join(contents);
jre_paths.insert(entry);
} else {
#[cfg(not(target_os = "macos"))]
{
let file_path = file_path.join(JAVA_BIN);
jre_paths.insert(file_path);
}
let file_path = file_path.join(JAVA_BIN);
jre_paths.insert(file_path);
}
}
}