fix: actually use custom paths when installing instance

This commit is contained in:
HerozDotExe 2025-11-26 12:18:53 +01:00
parent 5cbf88c6a2
commit 5d7f90eb6d
2 changed files with 11 additions and 11 deletions

View file

@ -91,7 +91,7 @@ export async function generateLaunchArguments(
versionManifest: Version,
javaRoot: string,
gameRoot: string,
versionJar: string,
versionRoot: string,
auth: Auth,
options: {
minRam?: string;
@ -109,7 +109,7 @@ export async function generateLaunchArguments(
const classPaths = generateClassPaths(
versionManifest,
path.join(gameRoot, "libraries"),
versionJar,
path.join(versionRoot, `${versionManifest.id}.jar`),
);
function p(args: string[], arg: Argument) {
@ -135,7 +135,7 @@ export async function generateLaunchArguments(
}
}
const log4j = await getArgument(versionManifest, gameRoot);
const log4j = await getArgument(versionManifest, versionRoot);
return {
command: getJavaExecutable(javaRoot),

View file

@ -62,7 +62,7 @@ export class Instance {
if (typeof paths === "string") {
this.paths = {
root: paths,
version: path.join(paths),
version: path.join(paths, "version", this.version),
assets: path.join(paths, "assets"),
java: path.join(paths, "java"),
libraries: path.join(paths, "libraries"),
@ -71,7 +71,7 @@ export class Instance {
} else {
this.paths = {
root: paths.root,
version: paths.version || path.join(paths.root),
version: paths.version || path.join(paths.root, "version", this.version),
assets: paths.assets || path.join(paths.root, "assets"),
java: paths.java || path.join(paths.root, "java"),
libraries: paths.libraries || path.join(paths.root, "libraries"),
@ -92,9 +92,9 @@ export class Instance {
async install() {
this.versionManifest = await core.version.getVersionManifest(
this.version,
this.paths.root,
this.paths.version,
);
await core.version.downloadJar(this.versionManifest, this.paths.root);
await core.version.downloadJar(this.versionManifest, this.paths.version);
const librariesDownloader = await core.LibrariesDownloader(
this.paths.libraries,
@ -144,10 +144,10 @@ export class Instance {
async launch() {
const args = await core.arguments.generateLaunchArguments(
await core.version.getVersionManifest("1.21.8", this.paths.root),
path.join(this.paths.java),
path.join(this.paths.root),
path.join(this.paths.root, `${this.version}.jar`),
await core.version.getVersionManifest(this.version, this.paths.version),
this.paths.java,
this.paths.root,
this.paths.version,
this.auth,
{ customGameArgs: this.args.game, customJvmArgs: this.args.java },
);