Elm_Config: add getpwent support, fix compilation on Windows

@fix
This commit is contained in:
Vincent Torri 2015-07-22 16:27:49 +02:00 committed by Tom Hacohen
parent e62ded189d
commit a1662717c5
2 changed files with 6 additions and 4 deletions

View File

@ -447,7 +447,7 @@ ELM_QUICKLAUNCH
AC_FUNC_ALLOCA
AC_CHECK_FUNCS([geteuid getuid])
AC_CHECK_FUNCS([geteuid getuid getpwent])
if test "x${want_quicklaunch}" != "xno"; then
AC_CHECK_FUNCS([fork clearenv])

View File

@ -574,19 +574,21 @@ _elm_config_user_dir_snprintf(char *dst,
#if !defined(HAVE_GETUID) || !defined(HAVE_GETEUID)
else
{
# if HAVE_GETPWENT
struct passwd *pw = getpwent();
if ((!pw) || (!pw->pw_dir)) goto end;
#ifdef DOXDG
# ifdef DOXDG
user_dir_len = eina_str_join_len
(dst, size, '/', pw->pw_dir, strlen(pw->pw_dir),
".config", sizeof(".config") - 1,
"elementary", sizeof("elementary") - 1);
#else
# else
user_dir_len = eina_str_join_len
(dst, size, '/', pw->pw_dir, strlen(pw->pw_dir),
ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
#endif
# endif
# endif /* HAVE_GETPWENT */
}
#endif