Skip to content

Commit

Permalink
Added base path to disco struct
Browse files Browse the repository at this point in the history
  • Loading branch information
skeezix committed Feb 23, 2009
1 parent 400788f commit 527d94f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions include/pnd_discovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions lib/pnd_discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
Expand All @@ -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 ) );
Expand Down
2 changes: 2 additions & 0 deletions test/discotest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down

0 comments on commit 527d94f

Please sign in to comment.