2 #include <stdio.h> /* for printf, NULL */
3 #include <stdlib.h> /* for free */
6 #include "pnd_container.h"
9 #include "pnd_discovery.h"
16 /* attempt to sort out the config file madness
19 // attempt to fetch a sensible default searchpath for configs
20 configpath = pnd_conf_query_searchpath();
22 // attempt to fetch the apps config to pick up a searchpath
25 apph = pnd_conf_fetch_by_id ( pnd_conf_apps, configpath );
28 appspath = pnd_conf_get_as_char ( apph, PND_APPS_KEY );
31 appspath = PND_APPS_SEARCHPATH;
34 overridespath = pnd_conf_get_as_char ( apph, PND_PXML_OVERRIDE_KEY );
36 if ( ! overridespath ) {
37 overridespath = PND_PXML_OVERRIDE_SEARCHPATH;
41 // couldn't find a useful app search path so use the default
42 appspath = PND_APPS_SEARCHPATH;
43 overridespath = PND_PXML_OVERRIDE_SEARCHPATH;
46 printf ( "Apps searchpath is '%s'\n", appspath );
47 printf ( "Apps overrides searchpath is '%s'\n", overridespath );
49 /* attempt to discover apps in the path
51 pnd_box_handle applist;
53 applist = pnd_disco_search ( appspath, overridespath );
55 // list the found apps (if any)
58 pnd_disco_t *d = pnd_box_get_head ( applist );
62 // display the app 'as is'
64 printf ( "App: %s\n", pnd_box_get_key ( d ) );
66 if ( d -> title_en ) {
67 printf ( " Name: %s\n", d -> title_en );
70 printf ( " Icon: %s\n", d -> icon );
72 if ( d -> unique_id ) {
73 printf ( " Unique ID: %s\n", d -> unique_id );
75 if ( d -> main_category ) {
76 printf ( " Category: %s\n", d -> main_category );
79 printf ( " Executable: %s\n", d -> exec );
81 if ( d -> clockspeed ) {
82 printf ( " Clockspeed: %s\n", d -> clockspeed );
86 d = pnd_box_get_next ( d );
91 printf ( "No applications found in search path\n" );
94 // exeunt with alarums
97 pnd_box_delete ( apph );