ecore_evas: use access() instead of stat()

Summary: stat() wasn't working on Windows due to some msys2/mingw quirk.

Reviewers: felipealmeida, cedric, vtorri

Subscribers: jenkins, jpeg

Tags: #windows

Differential Revision: https://phab.enlightenment.org/D5520

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
This commit is contained in:
Lauro Moura 2017-11-23 15:30:58 -08:00 committed by Cedric Bail
parent 0dbeb91bb9
commit 3afbcb2e27
1 changed files with 12 additions and 14 deletions

View File

@ -20,6 +20,16 @@ static Eina_Module *_ecore_evas_vnc = NULL;
# define ECORE_EVAS_ENGINE_NAME "module.so"
#endif
static inline Eina_Bool
_file_exists(const char *file)
{
if (!file) return EINA_FALSE;
if (access(file, F_OK) == -1) return EINA_FALSE;
return EINA_TRUE;
}
static Eina_Module *
_ecore_evas_vnc_server_module_try_load(const char *prefix,
Eina_Bool use_prefix_only)
@ -119,10 +129,9 @@ _ecore_evas_engine_load(const char *engine)
{
if (run_in_tree)
{
struct stat st;
snprintf(tmp, sizeof(tmp), "%s/%s/.libs/%s",
path, engine, ECORE_EVAS_ENGINE_NAME);
if (stat(tmp, &st) != 0)
if (!_file_exists(tmp))
tmp[0] = '\0';
}
}
@ -165,9 +174,8 @@ _ecore_evas_engine_init(void)
{
if (getenv("EFL_RUN_IN_TREE"))
{
struct stat st;
const char mp[] = PACKAGE_BUILD_DIR"/src/modules/ecore_evas/engines/";
if (stat(mp, &st) == 0)
if (_file_exists(mp))
{
_engines_paths = eina_list_append(_engines_paths, strdup(mp));
return;
@ -218,16 +226,6 @@ _ecore_evas_engine_shutdown(void)
eina_stringshare_del(path);
}
static Eina_Bool
_file_exists(const char *file)
{
struct stat st;
if (!file) return EINA_FALSE;
if (stat(file, &st) < 0) return EINA_FALSE;
return EINA_TRUE;
}
const Eina_List *
_ecore_evas_available_engines_get(void)
{