only read files end with json

This commit is contained in:
Zichao Lin 2023-10-20 22:42:54 +08:00
parent f8e47879f1
commit 2dbcab998f
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB

@ -79,6 +79,7 @@ exports.getGlobalConfig = function () {
exports.getConfigs = function () { exports.getConfigs = function () {
try { try {
var configsList = fs.readdirSync("configs"); var configsList = fs.readdirSync("configs");
configsList = configsList.filter((file) => file.endsWith(".json"));
} catch (e) { } catch (e) {
if ( if (
e == "Error: ENOENT: no such file or directory, scandir 'configs'" e == "Error: ENOENT: no such file or directory, scandir 'configs'"