Fixed up exec and icon paths
authorskeezix <skeezix@flotsam-vm.(none)>
Mon, 23 Feb 2009 21:20:38 +0000 (16:20 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Mon, 23 Feb 2009 21:20:38 +0000 (16:20 -0500)
include/pnd_discovery.h
lib/pnd_discovery.c
lib/pnd_tinyxml.cpp
test/discotest.c

index 0943fae..76ae900 100644 (file)
@@ -42,6 +42,7 @@ typedef struct
   char *exec;
   char *main_category;
   char *clockspeed;
+  char *startdir;
 } pnd_disco_t;
 
 void pnd_disco_destroy ( pnd_disco_t *p ); // a function name that simply could not be avoided
index 860af1f..53bd608 100644 (file)
@@ -127,7 +127,7 @@ 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
+      //char b [ 1024 ]; // TBD: also lame
       pnd_disco_t *p;
 
       p = pnd_box_allocinsert ( disco_box, (char*) fpath, sizeof(pnd_disco_t) );
@@ -138,8 +138,9 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
        p -> icon = strdup ( pnd_pxml_get_icon ( pxmlh ) );
       }
       if ( pnd_pxml_get_exec ( pxmlh ) ) {
-       snprintf ( b, 1024, "pnd_run_magic %s", pnd_pxml_get_exec ( pxmlh ) );
-       p -> exec = strdup ( b );
+       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 ) );
@@ -150,6 +151,9 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       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 ) ); 
+      }
 
     } else {
       //printf ( "Invalid PXML; skipping.\n" );
index 5b2822e..e0f2daa 100644 (file)
@@ -90,6 +90,7 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
        pElem=hRoot.FirstChild("icon").Element();
        if (pElem)
        {       
+#if 0
                char anotherbuffer [ FILENAME_MAX ];
                strcpy ( anotherbuffer, pFilename );
                char *s = strstr ( anotherbuffer, PXML_FILENAME );
@@ -99,8 +100,10 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
                } else if ( ( s = strrchr ( anotherbuffer, '/' ) ) ) {
                  s += 1;
                  strcpy ( s, strdup(pElem->GetText()));
-                 app->exec = strdup(anotherbuffer);
+                 app->icon = strdup(anotherbuffer);
                }
+#endif
+               app->icon = strdup ( pElem->GetText() );
        }
 
        pElem = hRoot.FirstChild( "description" ).FirstChildElement("en").Element();
@@ -178,9 +181,11 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
        pElem=hRoot.FirstChild("exec").Element();
        if (pElem)
        {       
+#if 0
                char anotherbuffer [ FILENAME_MAX ];
                strcpy ( anotherbuffer, pFilename );
                char *s = strstr ( anotherbuffer, PXML_FILENAME );
+               printf ( "exec %s\n", pElem->GetText() );
                if ( s ) {
                  strcpy ( s, strdup(pElem->GetText()));
                  app->exec = strdup(anotherbuffer);
@@ -189,6 +194,8 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
                  strcpy ( s, strdup(pElem->GetText()));
                  app->exec = strdup(anotherbuffer);
                }
+#endif
+               app->exec = strdup ( pElem->GetText() );
        }       
 
        pElem = hRoot.FirstChild( "category" ).FirstChildElement("main").Element();
index 0dd0432..af31896 100644 (file)
@@ -78,6 +78,9 @@ int main ( void) {
       if ( d -> exec ) {
        printf ( "  Executable: %s\n", d -> exec );
       }
+      if ( d -> startdir ) {
+       printf ( "  Start dir: %s\n", d -> startdir );
+      }
       if ( d -> clockspeed ) {
        printf ( "  Clockspeed: %s\n", d -> clockspeed );
       }