Added base path to disco struct
authorskeezix <skeezix@flotsam-vm.(none)>
Mon, 23 Feb 2009 21:31:06 +0000 (16:31 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Mon, 23 Feb 2009 21:31:06 +0000 (16:31 -0500)
include/pnd_discovery.h
lib/pnd_discovery.c
test/discotest.c

index 76ae900..19de2dc 100644 (file)
@@ -34,8 +34,10 @@ pnd_box_handle pnd_disco_search ( char *searchpath, char *overridespath );
 // another struct? Have always intended discovery_t to have minimal members.. just enough to lead to an
 // application (PXML, xecutable, name); if the apps want more details, they can use the pnd_pxml code to
 // fetch the full PXML and get all the details. But I think we got out of control here :)
-typedef struct
-{
+typedef struct {
+  // base
+  char *path_to_object; // full path to the PXML.xml or awesomeapp.pnd file
+  // strdup'd from PXML
   char *title_en;
   char *unique_id;
   char *icon;
index 53bd608..caf3ccb 100644 (file)
@@ -127,10 +127,14 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
 
     // check for validity and add to resultset if it looks executable
     if ( pnd_is_pxml_valid_app ( pxmlh ) ) {
-      //char b [ 1024 ]; // TBD: also lame
       pnd_disco_t *p;
 
       p = pnd_box_allocinsert ( disco_box, (char*) fpath, sizeof(pnd_disco_t) );
+
+      // base path
+      p -> path_to_object = strdup ( fpath );
+
+      // PXML fields
       if ( pnd_pxml_get_app_name_en ( pxmlh ) ) {
        p -> title_en = strdup ( pnd_pxml_get_app_name_en ( pxmlh ) );
       }
@@ -139,8 +143,6 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       }
       if ( pnd_pxml_get_exec ( pxmlh ) ) {
        p -> exec = strdup ( pnd_pxml_get_exec ( pxmlh ) );
-       //snprintf ( b, 1024, "pnd_run_magic %s", pnd_pxml_get_exec ( pxmlh ) );
-       //p -> exec = strdup ( b );
       }
       if ( pnd_pxml_get_unique_id ( pxmlh ) ) {
        p -> unique_id = strdup ( pnd_pxml_get_unique_id ( pxmlh ) );
index af31896..7186ce6 100644 (file)
@@ -63,6 +63,8 @@ int main ( void) {
 
       printf ( "App: %s\n", pnd_box_get_key ( d ) );
 
+      printf ( "  Base path: %s\n", d -> path_to_object );
+
       if ( d -> title_en ) {
        printf ( "  Name: %s\n", d -> title_en );
       }