From 527d94fc765c2a180006c5f38450751f0f5c8058 Mon Sep 17 00:00:00 2001 From: skeezix Date: Mon, 23 Feb 2009 16:31:06 -0500 Subject: [PATCH] Added base path to disco struct --- include/pnd_discovery.h | 6 ++++-- lib/pnd_discovery.c | 8 +++++--- test/discotest.c | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/pnd_discovery.h b/include/pnd_discovery.h index 76ae900..19de2dc 100644 --- a/include/pnd_discovery.h +++ b/include/pnd_discovery.h @@ -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; diff --git a/lib/pnd_discovery.c b/lib/pnd_discovery.c index 53bd608..caf3ccb 100644 --- a/lib/pnd_discovery.c +++ b/lib/pnd_discovery.c @@ -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 ) ); diff --git a/test/discotest.c b/test/discotest.c index af31896..7186ce6 100644 --- a/test/discotest.c +++ b/test/discotest.c @@ -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 ); } -- 2.39.5