Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/app-lib/src/launcher/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,11 @@ pub fn get_class_paths(
return None;
}

if !library.include_in_classpath {
if !library.include_in_classpath || library.is_native() {
return None;
}

Some(get_lib_path(
libraries_path,
&library.name,
library.native_classifier(java_arch).is_some(),
))
Some(get_lib_path(libraries_path, &library.name, false))
}))
.process_results(|iter| {
iter.unique().join(classpath_separator(java_arch))
Expand Down
11 changes: 10 additions & 1 deletion packages/app-lib/src/launcher/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,16 @@ pub async fn download_libraries(
return Ok(());
}

// When a library has natives, we only need to download such natives, as PrismLauncher does
if library.is_native()
&& library.native_classifier(java_arch).is_none()
{
tracing::trace!(
"Skipped incompatible native library {}",
&library.name
);
return Ok(());
}

if let Some((url, sha1, size)) =
library.native_download(java_arch)?
{
Expand Down
9 changes: 9 additions & 0 deletions packages/app-lib/src/launcher/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use minecraft_meta_manifest::{
use url::Url;

pub(crate) trait LibraryExt {
/// Whether this library declares platform-specific native classifiers.
fn is_native(&self) -> bool;

/// Native classification does not depend on classifier download metadata.
fn native_classifier(&self, java_arch: &str) -> Option<String>;

Expand All @@ -17,6 +20,12 @@ pub(crate) trait LibraryExt {
}

impl LibraryExt for Library {
fn is_native(&self) -> bool {
self.natives
.as_ref()
.is_some_and(|natives| !natives.is_empty())
}

/// Native classification does not depend on classifier download metadata.
fn native_classifier(&self, java_arch: &str) -> Option<String> {
let natives = self.natives.as_ref()?;
Expand Down
Loading