Move realpath to ecore_file_can_exec, since it always makes sense there.

SVN revision: 17074
This commit is contained in:
sebastid 2005-09-29 17:50:04 +00:00 committed by sebastid
parent f50cb7415e
commit 49b85e4e1f
2 changed files with 6 additions and 4 deletions

View File

@ -193,9 +193,11 @@ ecore_file_can_exec(const char *file)
static gid_t gid = -1;
struct stat st;
int ok;
char buf[PATH_MAX];
if (!file) return 0;
if (stat(file, &st) < 0) return 0;
if (!realpath(file, buf)) return 0;
if (stat(buf, &st) < 0) return 0;
ok = 0;
if (!have_uid) uid = getuid();

View File

@ -61,16 +61,16 @@ int
ecore_file_app_installed(const char *exe)
{
char *dir;
char buf[PATH_MAX], buf2[PATH_MAX];
char buf[PATH_MAX];
if (!exe) return 0;
if (realpath(exe, buf) && ecore_file_can_exec(buf)) return 1;
if (ecore_file_can_exec(exe)) return 1;
ecore_list_goto_first(__ecore_file_path_bin);
while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL)
{
snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
if (realpath(buf, buf2) && ecore_file_can_exec(buf2)) return 1;
if (ecore_file_can_exec(buf)) return 1;
}
return 0;
}