fix: fix older versions (1.7.10) not being launchable (natives for windows are available for x32 and x64 cpus)

This commit is contained in:
HerozDotExe 2026-04-23 18:14:55 +02:00
parent 39e16b7ede
commit d66c80f9dc
2 changed files with 25 additions and 8 deletions

View file

@ -1,11 +1,32 @@
import { Native, PoolFile, Version } from "../utils/types";
import { Library, Native, PoolFile, Version } from "../utils/types";
import path from "path";
import { ensureDir } from "../utils/fs";
import { isNeeded } from "../utils/rules";
import { os } from "../utils/systemInfo";
import { arch, os } from "../utils/systemInfo";
import { getTempFolder } from "../utils/temp";
import { DownloadAndUnzipPool } from "../utils/unzip";
function getClassifier(library: Library): Native {
switch (os()) {
case "osx":
return library.downloads!.classifiers!["natives-osx"] ||
library.downloads!.classifiers!["natives-macos"];
case "linux":
return library.downloads!.classifiers!["natives-linux"];
case "windows":
switch (arch()) {
case "x86":
return library.downloads!.classifiers!["natives-windows-32"] ||
library.downloads!.classifiers!["natives-windows"];
case "x64":
return library.downloads!.classifiers!["natives-windows-64"] ||
library.downloads!.classifiers!["natives-windows"];
default:
return library.downloads!.classifiers!["natives-windows"];
}
}
}
async function getNatives(versionManifest: Version, tempNativesPath: string) {
const files: PoolFile[] = [];
@ -15,11 +36,7 @@ async function getNatives(versionManifest: Version, tempNativesPath: string) {
if (library.downloads && library.downloads.classifiers) {
if (!isNeeded(library)) continue;
const native: Native =
os() === "osx"
? library.downloads.classifiers["natives-osx"] ||
library.downloads.classifiers["natives-macos"]
: library.downloads.classifiers[`natives-${os()}`];
const native = getClassifier(library)
const destination = path.join(
tempNativesPath,

View file

@ -83,7 +83,7 @@ export type Native = {
url: string;
};
type NativeOS = "natives-linux" | "natives-windows" | "natives-macos" | "natives-osx";
type NativeOS = "natives-linux" | "natives-windows"| "natives-windows-32" | "natives-windows-64" | "natives-macos" | "natives-osx";
type Rules = {
action: "allow" | "disallow";