- rc = readdir_r(dir, &entry, &e);
- while (!rc && e) {
- if (testd(dirfd, &entry)) {
- fd = openat(dirfd, entry.d_name, O_DIRECTORY|O_RDONLY);
- if (fd >= 0) {
- strcpy(aea->ver, entry.d_name);
- rc = aea3(fd, aea);
- close(fd);
- }
- }
- rc = readdir_r(dir, &entry, &e);
+ appid = alloca(2 + strlen(desc->id) + strlen(desc->version));
+ end = stpcpy(appid, desc->id);
+ *end++ = '@';
+ strcpy(end, desc->version);
+
+ if(json_add_str(result, "appid", appid)
+ || json_add_str(result, "id", desc->id)
+ || json_add_str(result, "version", desc->version)
+ || json_add_str(result, "path", path)
+ || json_add_int(result, "width", desc->width)
+ || json_add_int(result, "height", desc->height)
+ || json_add_str(result, "name", desc->name)
+ || json_add_str(result, "description", desc->description)
+ || json_add_str(result, "shortname", desc->name_short)
+ || json_add_str(result, "author", desc->author))
+ goto error3;
+
+ wgt_info_unref(info);
+ return result;
+
+error3:
+ wgt_info_unref(info);
+error2:
+ json_object_put(result);
+error:
+ return NULL;
+}
+
+static int add_appdesc(struct json_object *appset, struct json_object *app)
+{
+ struct json_object *appid;
+
+ if (!json_object_object_get_ex(app, "appid", &appid)) {
+ errno = EINVAL;
+ return -1;