delete git mods

This commit is contained in:
2021-01-20 21:08:28 +01:00
parent fbf7551fc2
commit 7a0ae4eb99

View File

@ -7,11 +7,13 @@ let globCallback;
let loopCounter = 0;
function main () {
modsLock = new Map(Object.entries(modsLock));
let deleteMods = new Map(modsLock);
let cacheDir = process.env.XDG_CACHE_HOME;
if(cacheDir == null) cacheDir = `${process.env.HOME}/.cache`;
let repoPathRoot = `${cacheDir}/minecraft-mod-packager`;
global.config.mods.git.forEach((gitRepo) => {
++loopCounter;
deleteMods.delete(gitRepo.url);
let repoPath = `${repoPathRoot}/${gitRepo.url.replace("://", "+")}/${gitRepo.branch}`;
fs.access(repoPath, (err) => {
if(err) {
@ -30,6 +32,11 @@ function main () {
}
});
});
deleteMods.forEach((mod) => {
fs.unlink(mod.filename, (err) => {
if(err) throw err;
});
});
}
function build(repo, repoPath, gitRepo) {