}
}
- // file association requests
- if ( ! pnd_emit_dotassoc ( info_dotdesktoppath, pndrun, d ) ) {
- pnd_log ( pndn_rem, "ERROR: Error creating file association .desktop file for app: %s\n", pnd_box_get_key ( d ) );
- }
-
// does this object request any mkdir's?
if ( d -> mkdir_sp ) {
// extra fields to emit_dotdesktop()'s function and breaking apps, or annoying callers down the road
unsigned char pnd_emit_dotinfo ( char *targetpath, char *pndrun, pnd_disco_t *p );
-// emit_dotassoc() will spit out a .desktop executable entry (more or less similar to the emit_dotdesktop above)
-// however in this variation the executable line is set up for invokation of a file association instead of the
-// normal executable line.
-// - lame code is a copy from emit_dotdesktop() .. I really need to clean this up and paramterize a subfunction..
-// - this function will emit all file association .desktops (not just one of them)
-unsigned char pnd_emit_dotassoc ( char *targetpath, char *pndrun, pnd_disco_t *p );
-unsigned char _pnd_emit_dotassoc ( char *targetpath, char *pndrun, pnd_disco_t *p, unsigned char i ); // will only emit the requested assoc 1, 2, 3
-
// emit_icon() will attempt to copy the icon from a PXML directory, or from a pnd file if appended,
// to the given directory; returns 1 on sucess, otherwise is a fail.
unsigned char pnd_emit_icon ( char *targetpath, pnd_disco_t *p );
// existing above, lets just copy from pxml and use a list of [123] members..
char *associationitem1_name;
char *associationitem1_filetype;
- char *associationitem1_command;
- char *associationitem1_args;
- char *associationitem2_name;
- char *associationitem2_filetype;
- char *associationitem2_command;
- char *associationitem2_args;
- char *associationitem3_name;
- char *associationitem3_filetype;
- char *associationitem3_command;
- char *associationitem3_args;
+ char *exec_dashdash_args;
+
} pnd_disco_t;
void pnd_disco_destroy ( pnd_disco_t *p ); // a function name that simply could not be avoided
char *pnd_pxml_get_exec ( pnd_pxml_handle h );
char *pnd_pxml_get_execargs ( pnd_pxml_handle h );
char *pnd_pxml_get_exec_option_no_x11 ( pnd_pxml_handle h );
+char *pnd_pxml_get_execdashdashargs ( pnd_pxml_handle h );
char *pnd_pxml_get_main_category ( pnd_pxml_handle h );
char *pnd_pxml_get_subcategory1 ( pnd_pxml_handle h );
char *pnd_pxml_get_subcategory2 ( pnd_pxml_handle h );
char *pnd_pxml_get_osversion_build ( pnd_pxml_handle h );
char *pnd_pxml_get_associationitem1_name ( pnd_pxml_handle h );
char *pnd_pxml_get_associationitem1_filetype ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem1_command ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem1_args ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem2_name ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem2_filetype ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem2_command ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem2_args ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem3_name ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem3_filetype ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem3_command ( pnd_pxml_handle h );
-char *pnd_pxml_get_associationitem3_args ( pnd_pxml_handle h );
+char *pnd_pxml_get_associationitem2_name ( pnd_pxml_handle h ); // may not be used
+char *pnd_pxml_get_associationitem2_filetype ( pnd_pxml_handle h ); // may not be used
+char *pnd_pxml_get_associationitem3_name ( pnd_pxml_handle h ); // may not be used
+char *pnd_pxml_get_associationitem3_filetype ( pnd_pxml_handle h ); // may not be used
char *pnd_pxml_get_clockspeed ( pnd_pxml_handle h );
char *pnd_pxml_get_background ( pnd_pxml_handle h );
char *pnd_pxml_get_startdir ( pnd_pxml_handle h );
char *osversion_build;
char *associationitem1_name;
char *associationitem1_filetype;
- char *associationitem1_command;
- char *associationitem2_name;
- char *associationitem2_filetype;
- char *associationitem2_command;
- char *associationitem3_name;
- char *associationitem3_filetype;
- char *associationitem3_command;
+ char *_unused1; // was previously unused, but slotted for association stuff
+ char *associationitem2_name; // may not be used
+ char *associationitem2_filetype; // may not be used
+ char *_unused2; // was previously unused, but slotted for association stuff
+ char *associationitem3_name; // may not be used
+ char *associationitem3_filetype; // may not be used
+ char *_unused3; // was previously unused, but slotted for association stuff
char *clockspeed;
char *background;
char *startdir;
char *package_name;
char *package_release_date;
char *mkdir_sp; // a colon separated list of paths to be mkdir'd (silently fail) when pnd is autodiscovered. path is always relative to the root of the hosting device.
-
char *info_name; // should be a struct..
char *info_filename;
char *info_type;
char *package_version_minor;
char *package_version_release;
char *package_version_build;
- char *associationitem1_args; // wish it could be above, but that would break existing ABI
- char *associationitem2_args; // wish it could be above, but that would break existing ABI
- char *associationitem3_args; // wish it could be above, but that would break existing ABI
+ char *exec_dashdash_args;
} pnd_pxml_t;
#define PND_PXML_ATTRNAME_EXECARGS "arguments"
#define PND_PXML_ATTRNAME_EXECWD "startdir"
#define PND_PXML_ATTRNAME_EXECNOX11 "x11"
+#define PND_PXML_ATTRNAME_DASHDASH "extraarguments"
/* <icon src="..." /> */
#define PND_PXML_ENAME_ICON "icon"
unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t *p ) {
char filename [ FILENAME_MAX ];
- char buffer [ 1024 ];
+ char buffer [ 4096 ];
FILE *f;
// specification
}
#endif
+ // association requests
+ if ( p -> associationitem1_filetype ) {
+ fprintf ( f, "MimeType=%s\n", p -> associationitem1_filetype );
+ }
+
if ( p -> exec ) {
char *nohup;
strncat ( buffer, p -> startdir, 1020 );
}
- // args
+ // args (regular args, for pnd_run.sh to handle)
if ( p -> execargs ) {
char argbuf [ 1024 ];
snprintf ( argbuf, 1000, " -a \"%s\"", p -> execargs );
strncat ( buffer, " -x ", 1020 );
}
+ // args (dashdash -- args, that the shell can screw with before pnd_run.sh gets them)
+ if ( p -> exec_dashdash_args ) {
+ char argbuf [ 4096 ];
+ snprintf ( argbuf, 4096, " -- %s", p -> exec_dashdash_args );
+ strncat ( buffer, argbuf, 4096 );
+ }
+
// newline
strncat ( buffer, "\n", 1020 );
return ( 1 );
}
-unsigned char pnd_emit_dotassoc ( char *targetpath, char *pndrun, pnd_disco_t *p ) {
-
- if ( p -> associationitem1_command ) {
- if ( ! _pnd_emit_dotassoc ( targetpath, pndrun, p, 1 ) ) {
- return ( 0 );
- }
- }
-
- if ( p -> associationitem2_command ) {
- if ( ! _pnd_emit_dotassoc ( targetpath, pndrun, p, 2 ) ) {
- return ( 0 );
- }
- }
-
- if ( p -> associationitem3_command ) {
- if ( ! _pnd_emit_dotassoc ( targetpath, pndrun, p, 3 ) ) {
- return ( 0 );
- }
- }
-
- return ( 1 );
-}
-
-unsigned char _pnd_emit_dotassoc ( char *targetpath, char *pndrun, pnd_disco_t *p, unsigned char i ) {
- char filename [ FILENAME_MAX ];
- char buffer [ 1024 ];
- FILE *f;
-
- char *command;
- char *args;
- char *filetype;
- char *mimename;
-
- if ( i == 1 ) {
- command = p -> associationitem1_command;
- args = p -> associationitem1_args;
- filetype = p -> associationitem1_filetype;
- mimename = p -> associationitem1_name;
- } else if ( i == 2 ) {
- command = p -> associationitem2_command;
- args = p -> associationitem2_args;
- filetype = p -> associationitem2_filetype;
- mimename = p -> associationitem2_name;
- } else if ( i == 3 ) {
- command = p -> associationitem3_command;
- args = p -> associationitem3_args;
- filetype = p -> associationitem3_filetype;
- mimename = p -> associationitem3_name;
- } else {
- return ( 0 ); // w-t-f
- }
-
- // specification
- // http://standards.freedesktop.org/desktop-entry-spec
-
- // validation
-
- if ( ! p -> unique_id ) {
- pnd_log ( PND_LOG_DEFAULT, "Can't emit dotdesktop for %s, missing unique-id\n", targetpath );
- return ( 0 );
- }
-
- if ( ! command ) {
- pnd_log ( PND_LOG_DEFAULT, "Can't emit dotdesktop for %s, missing exec\n", targetpath );
- return ( 0 );
- }
-
- if ( ! filetype ) {
- pnd_log ( PND_LOG_DEFAULT, "Can't emit dotdesktop for %s, missing MIME-type\n", targetpath );
- return ( 0 );
- }
-
- if ( ! targetpath ) {
- pnd_log ( PND_LOG_DEFAULT, "Can't emit dotdesktop for %s, missing target path\n", targetpath );
- return ( 0 );
- }
-
- if ( ! pndrun ) {
- pnd_log ( PND_LOG_DEFAULT, "Can't emit dotdesktop for %s, missing pnd_run.sh\n", targetpath );
- return ( 0 );
- }
-
- // set up
-
- sprintf ( filename, "%s/%s#%u#%u.desktop", targetpath, p -> unique_id, p -> subapp_number, i );
-
- // emit
-
- //printf ( "EMIT DOTDESKTOP '%s'\n", filename );
-
- f = fopen ( filename, "w" );
-
- if ( ! f ) {
- return ( 0 );
- }
-
- fprintf ( f, "%s\n", PND_DOTDESKTOP_HEADER );
-
- fprintf ( f, "NoDisplay=false\n" ); // file association entries shouldn't live in the menus; but if 'true', xfce won't show this association in the dialog.. stupid!
-
- if ( p -> title_en ) {
- snprintf ( buffer, 1020, "Name=%s\n", mimename );
- fprintf ( f, "%s", buffer );
- }
-
- fprintf ( f, "Type=Application\n" );
- fprintf ( f, "Version=1.0\n" );
-
- if ( p -> icon ) {
- snprintf ( buffer, 1020, "Icon=%s\n", p -> icon );
- fprintf ( f, "%s", buffer );
- }
-
- if ( p -> unique_id ) {
- fprintf ( f, "X-Pandora-UID=%s\n", p -> unique_id );
- }
-
- if ( p -> clockspeed ) {
- fprintf ( f, "X-Pandora-Clockspeed=%s\n", p -> clockspeed );
- }
-
- if ( p -> startdir ) {
- fprintf ( f, "X-Pandora-Startdir=%s\n", p -> startdir );
- }
-
- if ( filetype ) {
- pnd_log ( PND_LOG_DEFAULT, " EmitDesktopAssoc: Found file association request in PXML (%s) for mimetype (%s)\n", p -> title_en, filetype );
- fprintf ( f, "MimeType=%s\n", filetype );
- }
-
- if ( command ) {
- char *nohup;
-
- if ( p -> option_no_x11 ) {
- nohup = "/usr/bin/nohup ";
- } else {
- nohup = "";
- }
-
- // basics
- if ( p -> object_type == pnd_object_type_directory ) {
- snprintf ( buffer, 1020, "Exec=%s%s -p \"%s\" -e \"%s\" -b \"%s\"",
- nohup, pndrun, p -> object_path, command,
- p -> appdata_dirname ? p -> appdata_dirname : p -> unique_id );
- } else if ( p -> object_type == pnd_object_type_pnd ) {
- snprintf ( buffer, 1020, "Exec=%s%s -p \"%s/%s\" -e \"%s\" -b \"%s\"",
- nohup, pndrun, p -> object_path, p -> object_filename, command,
- p -> appdata_dirname ? p -> appdata_dirname : p -> unique_id );
- }
-
- // start dir
- if ( p -> startdir ) {
- strncat ( buffer, " -s ", 1020 );
- strncat ( buffer, p -> startdir, 1020 );
- }
-
- // args (pxml args)
- if ( p -> execargs ) {
- char argbuf [ 1024 ];
- snprintf ( argbuf, 1000, " -a \"%s\"", p -> execargs );
- strncat ( buffer, argbuf, 1020 );
- }
-
- // clockspeed
- if ( p -> clockspeed && atoi ( p -> clockspeed ) != 0 ) {
- strncat ( buffer, " -c ", 1020 );
- strncat ( buffer, p -> clockspeed, 1020 );
- }
-
- // exec options
- if ( pnd_pxml_get_x11 ( p -> option_no_x11 ) == pnd_pxml_x11_stop ) {
- strncat ( buffer, " -x ", 1020 );
- }
-
- // args (mimetype args)
- if ( args ) {
- char argbuf [ 1024 ];
- snprintf ( argbuf, 1000, " -- %s", args );
- strncat ( buffer, argbuf, 1020 );
- }
-
- // newline
- strncat ( buffer, "\n", 1020 );
-
- // emit
- fprintf ( f, "%s", buffer );
-
- // and lets copy in some stuff in case it makes .desktop consumers life easier
- if ( command ) { fprintf ( f, "X-Pandora-Exec=%s\n", command ); }
- if ( args ) { fprintf ( f, "X-Pandora-ExecArgs=%s\n", args ); }
- if ( p -> appdata_dirname ) { fprintf ( f, "X-Pandora-Appdata-Dirname=%s\n", p -> appdata_dirname ); }
- if ( p -> object_flags & PND_DISCO_FLAG_OVR ) { fprintf ( f, "X-Pandora-Object-Flag-OVR=%s\n", "Yes" ); }
- if ( p -> object_type == pnd_object_type_pnd ) {
- fprintf ( f, "X-Pandora-Object-Path=%s\n", p -> object_path );
- fprintf ( f, "X-Pandora-Object-Filename=%s\n", p -> object_filename );
- }
-
- }
-
- fprintf ( f, "Categories=Other\n" ); // NoDisplay means can't confirm choice in xfce, so how do we hide this out of the way?
-
- fprintf ( f, "%s\n", PND_DOTDESKTOP_SOURCE ); // should we need to know 'who' created the file during trimming
-
- fclose ( f );
-
- return ( 1 );
-} // dotassoc
-
unsigned char pnd_emit_icon ( char *targetpath, pnd_disco_t *p ) {
//#define BITLEN (8*1024)
#define BITLEN (64*1024)
if ( p -> package_version_build ) { free ( p -> package_version_build ); }
if ( p -> associationitem1_name ) { free ( p -> associationitem1_name ); }
if ( p -> associationitem1_filetype ) { free ( p -> associationitem1_filetype ); }
- if ( p -> associationitem1_command ) { free ( p -> associationitem1_command ); }
- if ( p -> associationitem1_args ) { free ( p -> associationitem1_args ); }
- if ( p -> associationitem2_name ) { free ( p -> associationitem2_name ); }
- if ( p -> associationitem2_filetype ) { free ( p -> associationitem2_filetype ); }
- if ( p -> associationitem2_command ) { free ( p -> associationitem2_command ); }
- if ( p -> associationitem2_args ) { free ( p -> associationitem2_args ); }
- if ( p -> associationitem3_name ) { free ( p -> associationitem3_name ); }
- if ( p -> associationitem3_filetype ) { free ( p -> associationitem3_filetype ); }
- if ( p -> associationitem3_command ) { free ( p -> associationitem3_command ); }
- if ( p -> associationitem3_args ) { free ( p -> associationitem3_args ); }
+ if ( p -> exec_dashdash_args ) { free ( p -> exec_dashdash_args ); }
return;
}
if ( pnd_pxml_get_associationitem1_name ( pxmlh ) ) {
p -> associationitem1_name = strdup ( pnd_pxml_get_associationitem1_name ( pxmlh ) );
p -> associationitem1_filetype = strdup ( pnd_pxml_get_associationitem1_filetype ( pxmlh ) );
- p -> associationitem1_command = strdup ( pnd_pxml_get_associationitem1_command ( pxmlh ) );
- p -> associationitem1_args = strdup ( pnd_pxml_get_associationitem1_args ( pxmlh ) );
//pnd_log ( PND_LOG_DEFAULT, " Disco: Found file association request in PXML (%s)\n", p -> title_en );
}
- if ( pnd_pxml_get_associationitem2_name ( pxmlh ) ) {
- p -> associationitem2_name = strdup ( pnd_pxml_get_associationitem2_name ( pxmlh ) );
- p -> associationitem2_filetype = strdup ( pnd_pxml_get_associationitem2_filetype ( pxmlh ) );
- p -> associationitem2_command = strdup ( pnd_pxml_get_associationitem2_command ( pxmlh ) );
- p -> associationitem2_args = strdup ( pnd_pxml_get_associationitem2_args ( pxmlh ) );
- }
- if ( pnd_pxml_get_associationitem3_name ( pxmlh ) ) {
- p -> associationitem3_name = strdup ( pnd_pxml_get_associationitem3_name ( pxmlh ) );
- p -> associationitem3_filetype = strdup ( pnd_pxml_get_associationitem3_filetype ( pxmlh ) );
- p -> associationitem3_command = strdup ( pnd_pxml_get_associationitem3_command ( pxmlh ) );
- p -> associationitem3_args = strdup ( pnd_pxml_get_associationitem3_args ( pxmlh ) );
- }
#endif
+ if ( pnd_pxml_get_execdashdashargs ( pxmlh ) ) {
+ p -> exec_dashdash_args = strdup ( pnd_pxml_get_execdashdashargs ( pxmlh ) );
+ }
// look for any PXML overrides, if requested
if ( disco_overrides ) {
if ( p -> associationitem1_filetype ) {
free ( p -> associationitem1_filetype );
}
- if ( p -> associationitem1_command ) {
- free ( p -> associationitem1_command );
- }
- if ( p -> associationitem1_args ) {
- free ( p -> associationitem1_args );
- }
if ( p -> associationitem2_name ) {
free ( p -> associationitem2_name );
}
if ( p -> associationitem2_filetype ) {
free ( p -> associationitem2_filetype );
}
- if ( p -> associationitem2_command ) {
- free ( p -> associationitem2_command );
- }
- if ( p -> associationitem2_args ) {
- free ( p -> associationitem2_args );
- }
if ( p -> associationitem3_name ) {
free ( p -> associationitem3_name );
}
if ( p -> associationitem1_filetype ) {
free ( p -> associationitem3_filetype );
}
- if ( p -> associationitem1_command ) {
- free ( p -> associationitem3_command );
- }
- if ( p -> associationitem1_args ) {
- free ( p -> associationitem3_args );
- }
if ( p -> clockspeed ) {
free ( p -> clockspeed );
}
if ( p -> package_version_build ) {
free ( p -> package_version_build );
}
+ if ( p -> exec_dashdash_args ) {
+ free ( p -> exec_dashdash_args );
+ }
free(p); /*very important!*/
return ( p -> exec_no_x11 );
}
+char *pnd_pxml_get_execdashdashargs ( pnd_pxml_handle h ) {
+ pnd_pxml_t *p = (pnd_pxml_t*) h;
+ return ( p -> exec_dashdash_args );
+}
+
char *pnd_pxml_get_main_category ( pnd_pxml_handle h ) {
pnd_pxml_t *p = (pnd_pxml_t*) h;
return ( p -> main_category );
return ( p -> associationitem1_filetype );
}
-char *pnd_pxml_get_associationitem1_command ( pnd_pxml_handle h ) {
- pnd_pxml_t *p = (pnd_pxml_t*) h;
- return ( p -> associationitem1_command );
-}
-
-char *pnd_pxml_get_associationitem1_args ( pnd_pxml_handle h ) {
- pnd_pxml_t *p = (pnd_pxml_t*) h;
- return ( p -> associationitem1_args );
-}
-
char *pnd_pxml_get_associationitem2_name ( pnd_pxml_handle h ) {
pnd_pxml_t *p = (pnd_pxml_t*) h;
return ( p -> associationitem2_name );
return ( p -> associationitem2_filetype );
}
-char *pnd_pxml_get_associationitem2_command ( pnd_pxml_handle h ) {
- pnd_pxml_t *p = (pnd_pxml_t*) h;
- return ( p -> associationitem2_command );
-}
-
-char *pnd_pxml_get_associationitem2_args ( pnd_pxml_handle h ) {
- pnd_pxml_t *p = (pnd_pxml_t*) h;
- return ( p -> associationitem2_args );
-}
-
char *pnd_pxml_get_associationitem3_name ( pnd_pxml_handle h ) {
pnd_pxml_t *p = (pnd_pxml_t*) h;
return ( p -> associationitem3_name );
return ( p -> associationitem3_filetype );
}
-char *pnd_pxml_get_associationitem3_command ( pnd_pxml_handle h ) {
- pnd_pxml_t *p = (pnd_pxml_t*) h;
- return ( p -> associationitem3_command );
-}
-
-char *pnd_pxml_get_associationitem3_args ( pnd_pxml_handle h ) {
- pnd_pxml_t *p = (pnd_pxml_t*) h;
- return ( p -> associationitem3_args );
-}
-
char *pnd_pxml_get_clockspeed ( pnd_pxml_handle h ) {
pnd_pxml_t *p = (pnd_pxml_t*) h;
return ( p -> clockspeed );
app->standalone = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECSTAL);
app->exec = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECCMD);
app->startdir = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECWD);
- app->exec_no_x11 = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECNOX11);
+ app->exec_no_x11 = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECNOX11);
app->execargs = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECARGS);
+ app->exec_dashdash_args = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_DASHDASH);
}
//The app icon:
{
i = 0;
- //Go through all associations. i serves as index; since the format only supports 3 associations we need to keep track of the number.
- for (pElem = pElem->FirstChildElement(PND_PXML_ENAME_ASSOC); pElem && i < 3;
+ for (pElem = pElem->FirstChildElement(PND_PXML_ENAME_ASSOC); pElem && i < 50;
pElem = pElem->NextSiblingElement(PND_PXML_ENAME_ASSOC), i++)
{
char *name = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ASSOCNAME);
char *filetype = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ASSOCFTYPE);
- char *command = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ASSOCCMD);
- char *args = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ASSOCARGS);
+ unsigned int maxlen;
- if ( ! ( name && filetype && command ) ) {
+ if ( ! ( name && filetype ) ) {
if ( name ) free(name);
if ( filetype ) free(filetype);
- if ( command ) free(command);
- if ( args ) free(args);
continue;
}
- switch ( i ) { //TODO: same problem here: only 3 associations supported
- case 0: {
- app->associationitem1_name = strdup ( name );
- app->associationitem1_filetype = strdup ( filetype );
- app->associationitem1_command = strdup ( command );
- if ( args ) {
- app->associationitem1_args = strdup ( args );
- }
- //pnd_log ( PND_LOG_DEFAULT, (char*)" Found file association request in PXML (%d-0)\n", i );
- break;
- }
- case 1: {
- app->associationitem2_name = strdup ( name );
- app->associationitem2_filetype = strdup ( filetype );
- app->associationitem2_command = strdup ( command );
- if ( args ) {
- app->associationitem2_args = strdup ( args );
- }
- //pnd_log ( PND_LOG_DEFAULT, (char*)" Found file association request in PXML (%d-1)\n", i );
- break;
- }
- case 2: {
- app->associationitem3_name = strdup ( name );
- app->associationitem3_filetype = strdup ( filetype );
- app->associationitem3_command = strdup ( command );
- if ( args ) {
- app->associationitem3_args = strdup ( args );
- }
- //pnd_log ( PND_LOG_DEFAULT, (char*)" Found file association request in PXML (%d-2)\n", i );
- } // case
- } // switch
+ if ( app -> associationitem1_name == NULL ) {
+ // first hit, just dupe
+ app -> associationitem1_name = strdup ( name );
+ app -> associationitem1_filetype = strdup ( filetype );
+ pnd_log ( PND_LOG_DEFAULT, (char*)" File assoc initial: %s -> %s\n", name, filetype );
+ } else {
+ // grow-append buffer
+
+ maxlen = strlen ( app -> associationitem1_name ) + strlen ( name ) + 3;
+ app -> associationitem1_name = (char*) realloc ( app -> associationitem1_name, maxlen );
+ strncat ( app -> associationitem1_name, "; ", maxlen );
+ strncat ( app -> associationitem1_name, name, maxlen );
+
+ maxlen = strlen ( app -> associationitem1_filetype ) + strlen ( filetype ) + 3;
+ app -> associationitem1_filetype = (char*) realloc ( app -> associationitem1_filetype, maxlen );
+ strncat ( app -> associationitem1_filetype, "; ", maxlen );
+ strncat ( app -> associationitem1_filetype, filetype, maxlen );
+
+ pnd_log ( PND_LOG_DEFAULT, (char*)" File assoc growpend: %s -> %s\n", name, filetype );
+ }
if ( name ) free(name);
if ( filetype ) free(filetype);
- if ( command ) free(command);
- if ( args ) free(args);
} // for
} // assoc