Fix error not being thrown

This commit is contained in:
Ethan O'Brien 2023-07-06 13:59:27 -05:00
parent 212e85c7b4
commit 899f8c1a82

View file

@ -139,13 +139,15 @@ class EJS_GameManager {
} }
createCueFile(fileNames) { createCueFile(fileNames) {
try { try {
fileNames = fileNames.sort((a, b) => {
return (parseInt(a.charAt()[0]) > parseInt(b.charAt()[0])) ? 1 : -1;
})
fileNames = fileNames.filter((item) => { fileNames = fileNames.filter((item) => {
return ["toc", "ccd", "exe", "pbp", "chd", "img", "bin"].includes(item.split(".").pop().toLowerCase()); return ["toc", "ccd", "exe", "pbp", "chd", "img", "bin"].includes(item.split(".").pop().toLowerCase());
}) })
fileNames = fileNames.sort((a, b) => {
if (isNaN(a.charAt()) || isNaN(b.charAt())) throw new Error("Incorrect file name format");
return (parseInt(a.charAt()) > parseInt(b.charAt())) ? 1 : -1;
})
} catch(e) { } catch(e) {
console.log(fileNames);
if (fileNames.length > 1) { if (fileNames.length > 1) {
console.warn("Could not auto-create cue file(s)."); console.warn("Could not auto-create cue file(s).");
return null; return null;