only installs cursemod with exact name match

This commit is contained in:
2021-01-21 22:00:51 +01:00
parent 2d1de103d8
commit e2938843b8
2 changed files with 11 additions and 3 deletions

View File

@ -9,7 +9,15 @@ function main() {
if(global.config.mods.curse.length === 0) globCallback("curse", {});
global.config.mods.curse.forEach(mod => {
getData(`search?categoryId=0&gameId=432&gameVersion=${encodeURI(global.config.gameVersion)}&index=0&pageSize=15&searchFilter=${encodeURI(mod)}&sectionId=6&sort=0`, (result) => { // resolve projectID
resolveDep(result[0].id, downloadMods);
let i = 0;
while(result[i].name !== mod) {
++i;
if(i === result.length) {
console.log(`cursemod ${mod} not found`);
return;
}
}
resolveDep(result[i].id, downloadMods);
});
});
}

View File

@ -59,11 +59,11 @@ function build(repo, repoPath, gitRepo) {
fs.readFile(`${repoPath}/gradle.properties`, "utf-8", (err, data) => {
if(err) throw err;
g2js.parseText(data).then((gradleProp) => {
if(newLock.filename != null) fs.unlink(util.modPath(newLock) (err) => {
if(newLock.filename != null) fs.unlink(util.modPath(newLock), (err) => {
if(err) throw err;
});
newLock.filename = `${gradleProp.archives_base_name}-${gradleProp.mod_version}.jar`;
fs.copyFile(`${buildPath}/${newLock.filename}`, util.modPath(newLock) (err) => {
fs.copyFile(`${buildPath}/${newLock.filename}`, util.modPath(newLock), (err) => {
if(err) throw err;
});
cbDecrease();