1
0
forked from Isma/mods

Update manifest

This commit is contained in:
srgooglo 2023-11-02 17:44:48 +01:00
parent a902c1606b
commit 0540d2e3c6

View File

@ -1,9 +1,9 @@
// This variables can be changed :)
global._ = {
pack_id: "mccom2023-dev",
version: "1.2.0",
pack_id: "mccom2023",
version: "1.3.0",
author: "MCommunity",
name: "MCommunity DEV",
name: "MCommunity",
description: "MCommunity official modpack.",
icon: "https://storage.ragestudio.net/gose-uploads/mccom/MCx128.png",
@ -56,12 +56,14 @@ function resolveMcPath() {
return minecraftGameFolder
}
function resolveMinecraftLauncher(args) {
function resolveMinecraftLauncher(args, cwd) {
let _path = null
console.log(os.type())
switch (os.type()) {
case "win32": {
_path = `%ProgramFiles(x86)%\Minecraft Launcher\MinecraftLauncher.exe`
case "Windows_NT": {
_path = path.resolve(cwd, "runwin.bat")
break
}
case "Darwin": {
@ -73,7 +75,7 @@ function resolveMinecraftLauncher(args) {
}
}
if (_path && Array.isArray(args)) {
if (_path && Array.isArray(args) && os.type() !== "Windows_NT") {
_path = [_path, ...args].join(" ")
}
@ -179,6 +181,15 @@ module.exports = {
}
fs.writeFileSync(profilesFilePath, JSON.stringify(profiles_json, null, 2))
if (os.type() === "Windows_NT") {
const runwinBat = path.resolve(pack_dir, "runwin.bat")
fs.writeFileSync(runwinBat, `
@echo off
cd "%ProgramFiles(x86)%/Minecraft Launcher"
start MinecraftLauncher.exe --workDir "${pack_dir}"
`, { encoding: 'utf8' })
}
},
uninstall: async ({ manifest, pack_dir, tmp_dir, spinner }) => {
const minecraftGameFolder = resolveMcPath()
@ -196,14 +207,22 @@ module.exports = {
}
},
execute: async ({ manifest, pack_dir, tmp_dir, spinner }) => {
const launcherBin = resolveMinecraftLauncher([
`--workDir ${pack_dir}`,
])
const launcherBin = resolveMinecraftLauncher([`--workDir ${pack_dir}`], os.type() === "Windows_NT" ? pack_dir : undefined)
console.log(launcherBin)
if (launcherBin) {
await child_process.exec(launcherBin)
if (!launcherBin) {
throw new Error("Minecraft Launcher binary not found")
}
await new Promise((resolve, reject) => {
const process = child_process.execFile(launcherBin, [], {
shell: true,
})
process.on("exit", resolve)
process.on("error", reject)
})
}
}