Skip over if folder is missing

This commit is contained in:
BlipRanger
2023-07-11 19:14:14 -04:00
parent 2454963129
commit de3b39f825

View File

@@ -2726,7 +2726,12 @@ app.get('/discover_extensions', jsonParser, function (_, response) {
.filter(f => fs.statSync(path.join(directories.extensions, f)).isDirectory()) .filter(f => fs.statSync(path.join(directories.extensions, f)).isDirectory())
.filter(f => f !== 'third-party'); .filter(f => f !== 'third-party');
// get all folders in the third-party folder // get all folders in the third-party folder, if it exists
if (!fs.existsSync(path.join(directories.extensions, 'third-party'))) {
return response.send(extensions);
}
const thirdPartyExtensions = fs const thirdPartyExtensions = fs
.readdirSync(path.join(directories.extensions, 'third-party')) .readdirSync(path.join(directories.extensions, 'third-party'))
.filter(f => fs.statSync(path.join(directories.extensions, 'third-party', f)).isDirectory()); .filter(f => fs.statSync(path.join(directories.extensions, 'third-party', f)).isDirectory());