Also check if the application itself can open files
This commit is contained in:
parent
eaca560520
commit
5bf2d3c595
|
@ -194,12 +194,14 @@ static int _can_execute_access_path(String const * path,
|
||||||
|
|
||||||
|
|
||||||
/* mimehandler_can_open */
|
/* mimehandler_can_open */
|
||||||
|
static int _can_open_application(MimeHandler * handler);
|
||||||
|
|
||||||
int mimehandler_can_open(MimeHandler * handler)
|
int mimehandler_can_open(MimeHandler * handler)
|
||||||
{
|
{
|
||||||
switch(mimehandler_get_type(handler))
|
switch(mimehandler_get_type(handler))
|
||||||
{
|
{
|
||||||
case MIMEHANDLER_TYPE_APPLICATION:
|
case MIMEHANDLER_TYPE_APPLICATION:
|
||||||
return mimehandler_can_execute(handler);
|
return _can_open_application(handler);
|
||||||
case MIMEHANDLER_TYPE_DIRECTORY:
|
case MIMEHANDLER_TYPE_DIRECTORY:
|
||||||
/* let errors be handled by the API user */
|
/* let errors be handled by the API user */
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -211,6 +213,28 @@ int mimehandler_can_open(MimeHandler * handler)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _can_open_application(MimeHandler * handler)
|
||||||
|
{
|
||||||
|
String const * program;
|
||||||
|
String const * p;
|
||||||
|
|
||||||
|
if(mimehandler_can_execute(handler) == 0)
|
||||||
|
return 0;
|
||||||
|
if((program = mimehandler_get_program(handler)) == NULL)
|
||||||
|
/* XXX should not fail */
|
||||||
|
return 0;
|
||||||
|
for(p = string_find(program, "%"); p != NULL; p = string_find(p, "%"))
|
||||||
|
switch(*(++p))
|
||||||
|
{
|
||||||
|
case 'f':
|
||||||
|
case 'F':
|
||||||
|
case 'u':
|
||||||
|
case 'U':
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* mimehandler_get_categories */
|
/* mimehandler_get_categories */
|
||||||
String const ** mimehandler_get_categories(MimeHandler * handler)
|
String const ** mimehandler_get_categories(MimeHandler * handler)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user