#include "pnd_pathiter.h"
#include "pnd_apps.h"
#include "pnd_pndfiles.h"
+#include "pnd_logger.h"
// need these 'globals' due to the way nftw and ftw work :/
static pnd_box_handle disco_box;
void pnd_disco_destroy ( pnd_disco_t *p ) {
- if ( p -> title_en ) {
- free ( p -> title_en );
- }
-
- if ( p -> icon ) {
- free ( p -> icon );
- }
-
- if ( p -> exec ) {
- free ( p -> exec );
- }
-
- if ( p -> unique_id ) {
- free ( p -> unique_id );
- }
-
- if ( p -> main_category ) {
- free ( p -> main_category );
- }
-
- if ( p -> clockspeed ) {
- free ( p -> clockspeed );
- }
+ if ( p -> title_en ) { free ( p -> title_en ); }
+ if ( p -> unique_id ) { free ( p -> unique_id ); }
+ if ( p -> icon ) { free ( p -> icon ); }
+ if ( p -> exec ) { free ( p -> exec ); }
+ if ( p -> clockspeed ) { free ( p -> clockspeed ); }
+ if ( p -> startdir ) { free ( p -> startdir ); }
+ if ( p -> option_no_x11 ) { free ( p -> option_no_x11 ); }
+ if ( p -> main_category ) { free ( p -> main_category ); }
+ if ( p -> main_category1 ) { free ( p -> main_category1 ); }
+ if ( p -> main_category2 ) { free ( p -> main_category2 ); }
+ if ( p -> alt_category ) { free ( p -> alt_category ); }
+ if ( p -> alt_category1 ) { free ( p -> alt_category1 ); }
+ if ( p -> alt_category2 ) { free ( p -> alt_category2 ); }
+ if ( p -> mkdir_sp ) { free ( p -> mkdir_sp ); }
return;
}
unsigned char valid = pnd_object_type_unknown;
pnd_pxml_handle pxmlh = 0;
unsigned int pxml_close_pos = 0;
+ unsigned char logit = pnd_log_do_buried_logging();
- //printf ( "disco root callback encountered '%s'\n", fpath );
+ if ( logit ) {
+ pnd_log ( PND_LOG_DEFAULT, "disco callback encountered '%s'\n", fpath );
+ }
// PXML.xml is a possible application candidate (and not a dir named PXML.xml :)
if ( typeflag & FTW_D ) {
- //printf ( " .. is dir, skipping\n" );
+ if ( logit ) {
+ pnd_log ( PND_LOG_DEFAULT, " .. is dir, skipping\n" );
+ }
return ( 0 ); // skip directories and other non-regular files
}
// if not a file of interest, just keep looking until we run out
if ( ! valid ) {
- //printf ( " .. bad filename, skipping\n" );
+ if ( logit ) {
+ pnd_log ( PND_LOG_DEFAULT, " .. bad filename, skipping\n" );
+ }
return ( 0 );
}
if ( pnd_is_pxml_valid_app ( pxmlh ) ) {
pnd_disco_t *p;
char *fixpxml;
+ char *z;
p = pnd_box_allocinsert ( disco_box, (char*) fpath, sizeof(pnd_disco_t) );
if ( pnd_pxml_get_app_name_en ( pxmlh ) ) {
p -> title_en = strdup ( pnd_pxml_get_app_name_en ( pxmlh ) );
}
+ if ( pnd_pxml_get_description_en ( pxmlh ) ) {
+ p -> desc_en = strdup ( pnd_pxml_get_description_en ( pxmlh ) );
+ }
if ( pnd_pxml_get_icon ( pxmlh ) ) {
p -> icon = strdup ( pnd_pxml_get_icon ( pxmlh ) );
}
if ( pnd_pxml_get_exec ( pxmlh ) ) {
p -> exec = strdup ( pnd_pxml_get_exec ( pxmlh ) );
}
+ if ( pnd_pxml_get_exec_option_no_x11 ( pxmlh ) ) {
+ p -> option_no_x11 = strdup ( pnd_pxml_get_exec_option_no_x11 ( pxmlh ) );
+ }
if ( pnd_pxml_get_unique_id ( pxmlh ) ) {
p -> unique_id = strdup ( pnd_pxml_get_unique_id ( pxmlh ) );
}
- if ( pnd_pxml_get_main_category ( pxmlh ) ) {
- p -> main_category = strdup ( pnd_pxml_get_main_category ( pxmlh ) );
- }
if ( pnd_pxml_get_clockspeed ( pxmlh ) ) {
p -> clockspeed = strdup ( pnd_pxml_get_clockspeed ( pxmlh ) );
}
if ( pnd_pxml_get_startdir ( pxmlh ) ) {
p -> startdir = strdup ( pnd_pxml_get_startdir ( pxmlh ) );
}
+ // category kruft
+ if ( pnd_pxml_get_main_category ( pxmlh ) ) {
+ p -> main_category = strdup ( pnd_pxml_get_main_category ( pxmlh ) );
+ }
+ if ( pnd_pxml_get_subcategory1 ( pxmlh ) ) {
+ p -> main_category1 = strdup ( pnd_pxml_get_subcategory1 ( pxmlh ) );
+ }
+ if ( pnd_pxml_get_subcategory2 ( pxmlh ) ) {
+ p -> main_category2 = strdup ( pnd_pxml_get_subcategory2 ( pxmlh ) );
+ }
+ if ( pnd_pxml_get_altcategory ( pxmlh ) ) {
+ p -> alt_category = strdup ( pnd_pxml_get_altcategory ( pxmlh ) );
+ }
+ if ( pnd_pxml_get_altsubcategory1 ( pxmlh ) ) {
+ p -> alt_category1 = strdup ( pnd_pxml_get_altsubcategory1 ( pxmlh ) );
+ }
+ if ( pnd_pxml_get_altsubcategory2 ( pxmlh ) ) {
+ p -> alt_category2 = strdup ( pnd_pxml_get_altsubcategory2 ( pxmlh ) );
+ }
+ // preview pics
+ if ( ( z = pnd_pxml_get_previewpic1 ( pxmlh ) ) ) {
+ p -> preview_pic1 = strdup ( z );
+ }
+ if ( ( z = pnd_pxml_get_previewpic2 ( pxmlh ) ) ) {
+ p -> preview_pic2 = strdup ( z );
+ }
+ // mkdirs
+ if ( pnd_pxml_get_mkdir ( pxmlh ) ) {
+ p -> mkdir_sp = strdup ( pnd_pxml_get_mkdir ( pxmlh ) );
+ }
} else {
//printf ( "Invalid PXML; skipping.\n" );