Skip to content

Commit

Permalink
fix: Fallback to previous format if parsing patches.json fails in R…
Browse files Browse the repository at this point in the history
…eVanced API 4 format
  • Loading branch information
inotia00 committed Dec 21, 2024
1 parent c4bbca8 commit 170ff7d
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions wsEvents/getApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,25 @@ async function fetchPackages(packages) {
*/
module.exports = async function getPatches(ws) {
const patchesJson = `${global.jarNames.patchesList}`;
if (!existsSync(patchesJson)) {
const java = `${global.javaCmd}`;
const cli = `${global.jarNames.cli}`;
const patches = `${global.jarNames.patchesJar}`;
const command = `${java} -jar ${cli} patches --path=${patchesJson} ${patches}`;

const java = `${global.javaCmd}`;
const cli = `${global.jarNames.cli}`;
const patches = `${global.jarNames.patchesJar}`;
const command = `${java} -jar "${cli}" patches --path="${patchesJson}" "${patches}"`;

try {
const patchesList = JSON.parse(
readFileSync(global.jarNames.patchesList, 'utf8')
);
for (const patches of patchesList) {
if (patches.compatiblePackages === null) continue;
for (const packages of patches.compatiblePackages) {
}
}
} catch (e) {
await exec(command);
}

const patchesList = JSON.parse(
readFileSync(global.jarNames.patchesList, 'utf8')
);
Expand Down

0 comments on commit 170ff7d

Please sign in to comment.