diff options
| author | 2026-01-20 13:44:21 +0800 | |
|---|---|---|
| committer | 2026-01-20 13:44:21 +0800 | |
| commit | 7338b8627833018a0e3c05c3c4f3cc7fc182e8d2 (patch) | |
| tree | 23e39e5603aadc10d6b2d7efad063c68f357a860 /src-tauri/src/core/java.rs | |
| parent | dbf781a35b96252e0199fec4337515651e49a8f6 (diff) | |
| parent | cf6cd6ba667b35e352b705946420cf4acab2b004 (diff) | |
| download | DropOut-7338b8627833018a0e3c05c3c4f3cc7fc182e8d2.tar.gz DropOut-7338b8627833018a0e3c05c3c4f3cc7fc182e8d2.zip | |
[Chore] branch: Sync with main (#75)
Diffstat (limited to 'src-tauri/src/core/java.rs')
| -rw-r--r-- | src-tauri/src/core/java.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src-tauri/src/core/java.rs b/src-tauri/src/core/java.rs index d3e1bb9..2e3c8a7 100644 --- a/src-tauri/src/core/java.rs +++ b/src-tauri/src/core/java.rs @@ -855,22 +855,19 @@ fn parse_java_version(version: &str) -> u32 { // - New format: 17.0.1, 11.0.5+10 (Java 11+) // - Format with build: 21.0.3+13-Ubuntu-0ubuntu0.24.04.1 // - Format with underscores: 1.8.0_411 - + // First, strip build metadata (everything after '+') let version_only = version.split('+').next().unwrap_or(version); - + // Remove trailing junk (like "-Ubuntu-0ubuntu0.24.04.1") - let version_only = version_only - .split('-') - .next() - .unwrap_or(version_only); - + let version_only = version_only.split('-').next().unwrap_or(version_only); + // Replace underscores with dots (1.8.0_411 -> 1.8.0.411) let normalized = version_only.replace('_', "."); - + // Split by dots let parts: Vec<&str> = normalized.split('.').collect(); - + if let Some(first) = parts.first() { if *first == "1" { // Old format: 1.8.0 -> major is 8 |