fix macOS (#509)

This commit is contained in:
Daksh Jain 2026-06-30 18:31:07 -04:00 • committed by GitHub
parent e0a645f701
commit 467164a945
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 18 deletions

View file

@ -199,8 +199,11 @@ pub async fn launch_minecraft(
}) })
}); });
// On macOS, always remove DYLD_FALLBACK_LIBRARY_PATH which can interfere with
// LWJGL native library loading for OpenAL and other native libraries.
// This is necessary for both debug (cargo sets it) and release builds.
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
if std::env::var("CARGO").is_ok() { {
command.env_remove("DYLD_FALLBACK_LIBRARY_PATH"); command.env_remove("DYLD_FALLBACK_LIBRARY_PATH");
} }

View file

@ -308,23 +308,55 @@ fn internal_locate_java() -> Vec<PathBuf> {
fn internal_locate_java() -> Vec<PathBuf> { fn internal_locate_java() -> Vec<PathBuf> {
let mut found = Vec::new(); let mut found = Vec::new();
// TODO(macos): More paths for Java installations // Standard macOS JDK location: /Library/Java/JavaVirtualMachines/*.jdk/Contents/Home/bin/java
if let Ok(entries) = std::fs::read_dir("/Library/Java/JavaVirtualMachines") {
for entry in entries.flatten() {
let java_bin = entry
.path()
.join("Contents")
.join("Home")
.join("bin")
.join(JAVA_BIN);
if java_bin.exists() {
found.push(java_bin);
}
}
}
let paths = vec![ // System Java VM framework /usr/bin/java (the Apple-provided stub)
r"/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands", let sys_java = PathBuf::from(
r"/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java", "/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands",
r"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home", )
]; .join(JAVA_BIN);
if sys_java.exists() {
found.push(sys_java);
}
for path in paths { // Java Applet Plugin (JRE)
let path = PathBuf::from(path).join(get_java_bin()); let plugin_java = PathBuf::from(
if path.exists() { "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home",
found.push(path); )
.join("bin")
.join(JAVA_BIN);
if plugin_java.exists() {
found.push(plugin_java);
}
// SDKMAN installations
if let Ok(home) = std::env::var("HOME") {
let sdkman_dir =
PathBuf::from(home).join(".sdkman").join("candidates").join("java");
if let Ok(entries) = std::fs::read_dir(sdkman_dir) {
for entry in entries.flatten() {
let java_bin = entry.path().join("bin").join(JAVA_BIN);
if java_bin.exists() {
found.push(java_bin);
}
}
} }
} }
found = find_java_in_path(found); found = find_java_in_path(found);
found found
} }
@ -450,12 +482,6 @@ pub async fn install_java_package(package: &JavaPackage) -> LauncherResult<PathB
.to_string(), .to_string(),
); );
#[cfg(target_os = "macos")]
{
let java_version = package.java_version.first().unwrap().to_string();
base_path = base_path.join(format!("zulu-{java_version}.jre"));
}
base_path = base_path.join(get_java_bin()); base_path = base_path.join(get_java_bin());
#[cfg(any(target_os = "macos", target_os = "linux"))] #[cfg(any(target_os = "macos", target_os = "linux"))]

View file

@ -4,6 +4,11 @@ packages:
- packages/* - packages/*
- .github/actions/* - .github/actions/*
allowBuilds:
'@tailwindcss/oxide': true
esbuild: true
unrs-resolver: true
catalog: catalog:
tsx: ^4.19.4 tsx: ^4.19.4
typescript: ^5.8.3 typescript: ^5.8.3