Fixed mod hashing to avoid dupes

This commit is contained in:
Danielv123 committed 2017-01-07 23:37:10 +01:00
1 parent a49f98b228
commit e961ca6d56
1 file changed
+6 -6
+6 -6
View File
@@ -401,27 +401,27 @@ function hashMods(instanceName, callback) {
hash: hash,
}
// check if this callback has ran once for each mod
if(hashedMods.length == mods.length + instanceMods.length) {
if(hashedMods.length == /*mods.length*/ + instanceMods.length) {
callback(hashedMods);
}
//console.log(modname)
}
let hashedMods = [];
var i = 0;
let mods = fs.readdirSync("./sharedMods/")
/*let mods = fs.readdirSync("./sharedMods/")*/
let instanceMods = fs.readdirSync("./instances/"+instanceName+"/mods/")
for(o=0;o<mods.length;o++) {
/*for(o=0;o<mods.length;o++) {
if(path.extname(mods[o]) != ".zip") {
mods = mods.splice(mods.indexOf(mods[o]), 1); // remove element from array
}
}
}*/
for(o=0;o<instanceMods.length;o++) {
if(path.extname(instanceMods[o]) != ".zip") {
instanceMods.splice(instanceMods.indexOf(instanceMods[o]), 1); // remove element from array
}
}
for(i=0;i<mods.length;i++){
/*for(i=0;i<mods.length;i++){
let path = "./sharedMods/"+mods[i];
let name = mods[i];
let options = {
@@ -435,7 +435,7 @@ function hashMods(instanceName, callback) {
throw error;
}
});
}
}*/
for(i=0; i<instanceMods.length; i++){
let path = "./instances/"+instanceName+"/mods/"+instanceMods[i];
let name = instanceMods[i];