forked from Isma/mods
1
0
Fork 0

Update manifest

This commit is contained in:
srgooglo 2023-11-02 23:28:44 +01:00
parent e8dc666159
commit c549b34d6d
1 changed files with 8 additions and 3 deletions

View File

@ -13,7 +13,6 @@ global._ = {
installForge: false, installForge: false,
} }
// Please do not edit this following code, for gods sake.
const os = require("node:os") const os = require("node:os")
const path = require("node:path") const path = require("node:path")
const fs = require("node:fs") const fs = require("node:fs")
@ -149,6 +148,9 @@ module.exports = {
} }
} }
const minecraftGameFolder = resolveMcPath()
const legacyLauncherProfiles = path.resolve(minecraftGameFolder, "launcher_profiles.json")
const profilesFilePath = path.resolve(pack_dir, "launcher_profiles.json") const profilesFilePath = path.resolve(pack_dir, "launcher_profiles.json")
let profiles_json = { let profiles_json = {
@ -169,7 +171,7 @@ module.exports = {
profiles: {}, profiles: {},
} }
profiles_json.profiles[manifest.id] = { const profileData = {
name: manifest.pack_name, name: manifest.pack_name,
gameDir: pack_dir, gameDir: pack_dir,
created: "2023-00-00T00:00:00.002Z", created: "2023-00-00T00:00:00.002Z",
@ -180,6 +182,10 @@ module.exports = {
icon: await readImageToB64(`${pack_dir}/icon/mc.png`), icon: await readImageToB64(`${pack_dir}/icon/mc.png`),
} }
legacyLauncherProfiles.profiles[manifest.id] = profileData
profiles_json.profiles[manifest.id] = profileData
fs.writeFileSync(profilesFilePath, JSON.stringify(profiles_json, null, 2)) fs.writeFileSync(profilesFilePath, JSON.stringify(profiles_json, null, 2))
if (os.type() === "Windows_NT") { if (os.type() === "Windows_NT") {
@ -223,6 +229,5 @@ start MinecraftLauncher.exe --workDir "${pack_dir}"
process.on("exit", resolve) process.on("exit", resolve)
process.on("error", reject) process.on("error", reject)
}) })
} }
} }