xlicore
Version: 
Currently only used for my own launcher, proper docs will come later (hopefully).
15 lines (14 loc) • 535 B
JavaScript
export function makeClasspath(launch, ...classpaths) {
    const classpath = classpaths.flat();
    const filterentries = classpath.map((x) => ({
        full_path: x,
        name: x.replace(/^.*[\\/](.*)(?:.*[\\/]){2}.*$/gm, "$1"),
        isNative: x.match(/^.*[\\/].*natives.*$/) != undefined
    }));
    const filtered = filterentries.reduce((acc, cv) => {
        if (cv.isNative || !acc.some(x => x.name == cv.name))
            acc.push(cv);
        return acc;
    }, new Array);
    return filtered.map(x => x.full_path);
}