evas: don't try all loader on directory.

SVN revision: 59235
This commit is contained in:
Cedric BAIL 2011-05-06 09:36:24 +00:00
parent 8820713691
commit a68c149866
2 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,4 @@
2011-01-29 Carsten Haitzler (The Rasterman)
6~2011-01-29 Carsten Haitzler (The Rasterman)
1.0.0 release
@ -312,3 +312,7 @@
are possibly faster. I haven't noticed any difference between the
two speed-wise, but there probably are in some rare cases.
2011-05-06 Cedric Bail
* Don't try all image loader when user is pointing them on a directory.

View File

@ -1,3 +1,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "evas_common.h"
#include "evas_private.h"
#include "evas_cs.h"
@ -82,6 +86,7 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
Evas_Image_Load_Func *evas_image_load_func = NULL;
const char *loader = NULL, *end;
Evas_Module *em;
struct stat st;
unsigned int i;
int len, ret = EVAS_LOAD_ERROR_NONE;
struct evas_image_foreach_loader_data fdata;
@ -100,6 +105,12 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
}
}
#endif
if (stat(ie->file, &st) != 0 || S_ISDIR(st.st_mode))
{
DBG("trying to open directory '%s' !", ie->file);
return EVAS_LOAD_ERROR_DOES_NOT_EXIST;
}
len = strlen(ie->file);
end = ie->file + len;
for (i = 0; i < (sizeof (loaders) / sizeof(struct ext_loader_s)); i++)