mirror of https://github.com/espruino/BangleApps
Port sanitychess.js to metadata.json
parent
d8d0dae4b5
commit
6f9cd73425
|
@ -26,14 +26,19 @@ function WARN(s) {
|
|||
console.log("Warning: "+s);
|
||||
}
|
||||
|
||||
var appsFile, apps;
|
||||
var apps = [];
|
||||
var dirs = fs.readdirSync(APPSDIR, {withFileTypes: true});
|
||||
dirs.forEach(dir => {
|
||||
var appsFile;
|
||||
if (dir.name.startsWith("_example"))
|
||||
return;
|
||||
try {
|
||||
appsFile = fs.readFileSync(BASEDIR+"apps.json").toString();
|
||||
appsFile = fs.readFileSync(APPSDIR+dir.name+"/metadata.json").toString();
|
||||
} catch (e) {
|
||||
ERROR("apps.json not found");
|
||||
return;
|
||||
}
|
||||
try{
|
||||
apps = JSON.parse(appsFile);
|
||||
apps.push(JSON.parse(appsFile));
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
var m = e.toString().match(/in JSON at position (\d+)/);
|
||||
|
@ -46,9 +51,9 @@ try{
|
|||
console.log("===============================================");
|
||||
}
|
||||
console.log(m);
|
||||
ERROR("apps.json not valid JSON");
|
||||
|
||||
ERROR(dir.name+"/metadata.json not valid JSON");
|
||||
}
|
||||
});
|
||||
|
||||
const APP_KEYS = [
|
||||
'id', 'name', 'shortName', 'version', 'icon', 'screenshots', 'description', 'tags', 'type',
|
||||
|
|
Loading…
Reference in New Issue