Skip to content

Commit 70e0fc4

Browse files
committed
fix: 因影响游戏启动,移除库去重机制
1 parent d78d537 commit 70e0fc4

1 file changed

Lines changed: 1 addition & 37 deletions

File tree

  • ZalithLauncher/src/main/java/com/movtery/zalithlauncher/game/launch

ZalithLauncher/src/main/java/com/movtery/zalithlauncher/game/launch/LaunchArgs.kt

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import com.movtery.zalithlauncher.ui.screens.content.elements.QuickPlay
4343
import com.movtery.zalithlauncher.utils.file.child
4444
import com.movtery.zalithlauncher.utils.logging.Logger
4545
import com.movtery.zalithlauncher.utils.network.ServerAddress
46-
import com.movtery.zalithlauncher.utils.string.compareVersion
4746
import com.movtery.zalithlauncher.utils.string.insertJSONValueList
4847
import com.movtery.zalithlauncher.utils.string.isEmptyOrBlank
4948
import com.movtery.zalithlauncher.utils.string.isLowerTo
@@ -317,42 +316,7 @@ class LaunchArgs(
317316
}
318317
}
319318

320-
//最后进行去重
321-
val deduplicated = LinkedHashMap<GameManifest.Library, String>()
322-
val bestVersionMap = mutableMapOf<String, Pair<GameManifest.Library, String>>()
323-
324-
for ((lib, path) in libs) {
325-
val nameParts = lib.name.split(":")
326-
if (nameParts.size < 3) {
327-
deduplicated[lib] = path
328-
continue
329-
}
330-
val groupArtifact = "${nameParts[0]}:${nameParts[1]}"
331-
val version = nameParts[2]
332-
333-
val existing = bestVersionMap[groupArtifact]
334-
if (existing == null) {
335-
bestVersionMap[groupArtifact] = lib to path
336-
deduplicated[lib] = path
337-
} else {
338-
val existingVersion = existing.first.name.split(":")[2]
339-
val cmp = version.compareVersion(existingVersion)
340-
if (cmp > 0) {
341-
//重复库,仅保留高版本
342-
Logger.info(TAG, "Duplicate library detected: $groupArtifact, replacing version $existingVersion with higher version $version")
343-
deduplicated.remove(existing.first)
344-
bestVersionMap[groupArtifact] = lib to path
345-
deduplicated[lib] = path
346-
} else if (cmp < 0) {
347-
Logger.debug(TAG, "Duplicate library detected: $groupArtifact, ignoring lower version $version (keeping $existingVersion)")
348-
} else {
349-
//版本重复,仅保留一�?
350-
Logger.debug(TAG, "Duplicate library detected: $groupArtifact, ignoring duplicate version $version (keeping first occurrence)")
351-
}
352-
}
353-
}
354-
355-
return deduplicated.values.toTypedArray<String>()
319+
return libs.values.toTypedArray<String>()
356320
}
357321

358322

0 commit comments

Comments
 (0)