Add checks to check for unknown files
This commit is contained in:
parent
dc6f33c51b
commit
1515a008f0
|
@ -184,7 +184,7 @@ function validateTOML(path) {
|
|||
|
||||
if (field === "vc") {
|
||||
validateContents(tomlDoc, "vc_system", field => {
|
||||
if (config.vc-systems.indexOf(field) === -1) {
|
||||
if (config.vc_systems.indexOf(field) === -1) {
|
||||
validationError(`Could not find VC console \"${field}\"!`);
|
||||
}
|
||||
});
|
||||
|
@ -355,13 +355,22 @@ getDirectories(config.directory).forEach(function (game) {
|
|||
let inputDirectoryGame = `${config.directory}/${game}`;
|
||||
currentGame = game;
|
||||
|
||||
// Check that everything is lowercase.
|
||||
// Check that everything is lowercase and is a known file.
|
||||
getFiles(inputDirectoryGame).forEach(file => {
|
||||
if (!isValidFilename(file)) {
|
||||
if (config.permitted_files.indexOf(file) === -1) {
|
||||
validationError(`Unknown file \"${file}\"!`);
|
||||
} else if (!isValidFilename(file)) {
|
||||
validationError(`File \"${file}\" contains bad characters!`);
|
||||
}
|
||||
});
|
||||
|
||||
// Check that all directories are known.
|
||||
getDirectories(inputDirectoryGame).forEach(file => {
|
||||
if (config.permitted_dirs.indexOf(file) === -1) {
|
||||
validationError(`Unknown directory \"${file}\"!`);
|
||||
}
|
||||
});
|
||||
|
||||
// Verify the game's boxart.
|
||||
validateImage(`${inputDirectoryGame}/${config.boxart.filename}`, config.boxart);
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
"directory": "..",
|
||||
"regions": ["jpn", "usa", "eur", "aus", "chn", "kor", "twn", "all"],
|
||||
"gametypes": ["vc", "dsi", "eshop"],
|
||||
"vc-systems": ["nes", "snes", "gb", "gbc", "gba", "gg"],
|
||||
"vc_systems": ["nes", "snes", "gb", "gbc", "gba", "gg"],
|
||||
|
||||
"permitted_files": ["boxart.png", "icon.png", "game.dat"],
|
||||
"permitted_dirs": ["screenshots", "savefiles"],
|
||||
|
||||
"boxart": { "filename": "boxart.png", "sizes": [{"width": 328, "height": 300}, {"width": 500, "height": 300}], "type": "image/png"},
|
||||
"icon": { "filename": "icon.png", "sizes": [{"width": 48, "height": 48}], "type": "image/png"},
|
||||
"screenshots": { "dirname": "screenshots", "sizes": [{"width": 400, "height": 480}], "type": "image/png"},
|
||||
|
|
Reference in New Issue