delete git mods
This commit is contained in:
@ -7,11 +7,13 @@ let globCallback;
|
|||||||
let loopCounter = 0;
|
let loopCounter = 0;
|
||||||
function main () {
|
function main () {
|
||||||
modsLock = new Map(Object.entries(modsLock));
|
modsLock = new Map(Object.entries(modsLock));
|
||||||
|
let deleteMods = new Map(modsLock);
|
||||||
let cacheDir = process.env.XDG_CACHE_HOME;
|
let cacheDir = process.env.XDG_CACHE_HOME;
|
||||||
if(cacheDir == null) cacheDir = `${process.env.HOME}/.cache`;
|
if(cacheDir == null) cacheDir = `${process.env.HOME}/.cache`;
|
||||||
let repoPathRoot = `${cacheDir}/minecraft-mod-packager`;
|
let repoPathRoot = `${cacheDir}/minecraft-mod-packager`;
|
||||||
global.config.mods.git.forEach((gitRepo) => {
|
global.config.mods.git.forEach((gitRepo) => {
|
||||||
++loopCounter;
|
++loopCounter;
|
||||||
|
deleteMods.delete(gitRepo.url);
|
||||||
let repoPath = `${repoPathRoot}/${gitRepo.url.replace("://", "+")}/${gitRepo.branch}`;
|
let repoPath = `${repoPathRoot}/${gitRepo.url.replace("://", "+")}/${gitRepo.branch}`;
|
||||||
fs.access(repoPath, (err) => {
|
fs.access(repoPath, (err) => {
|
||||||
if(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) {
|
function build(repo, repoPath, gitRepo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user