jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e1eb5b8b86a4b8e00e06b605625f2c814092ba5e

commit e1eb5b8b86a4b8e00e06b605625f2c814092ba5e
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Fri Apr 8 10:51:20 2016 +0900

    efl_vpath: Fix compilation for windows
    
    Patch by @vtorri
    
    Fixes T3431
---
 src/lib/efl/interfaces/efl_vpath_core.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/lib/efl/interfaces/efl_vpath_core.c 
b/src/lib/efl/interfaces/efl_vpath_core.c
index d956643..d9aec69 100644
--- a/src/lib/efl/interfaces/efl_vpath_core.c
+++ b/src/lib/efl/interfaces/efl_vpath_core.c
@@ -27,8 +27,8 @@ static Efl_Vpath_Core *vpath_core = NULL;
 EOLIAN static Eo_Base *
 _efl_vpath_core_eo_base_constructor(Eo *obj, Efl_Vpath_Core_Data *pd)
 {
-   char buf[PATH_MAX], bufhome[PATH_MAX], *s;
-   const char *home;
+   char buf[PATH_MAX], bufhome[PATH_MAX];
+   const char *home, *s;
 
    if (vpath_core) return NULL;
    obj = eo_constructor(eo_super(obj, MY_CLASS));
@@ -42,6 +42,8 @@ _efl_vpath_core_eo_base_constructor(Eo *obj, 
Efl_Vpath_Core_Data *pd)
    home = eina_environment_home_get();
    if (!home)
      {
+        /* Windows does not have getuid(), but home can't be NULL */
+#ifdef HAVE_GETUID
         uid_t uid = getuid();
         struct stat st;
 
@@ -53,14 +55,13 @@ _efl_vpath_core_eo_base_constructor(Eo *obj, 
Efl_Vpath_Core_Data *pd)
              if (stat("/tmp", &st) == 0) home = "/tmp";
              else home = "/";
           }
+#else
+        home = "/";
+#endif
      }
    efl_vpath_core_meta_set(obj, "home", home);
    // tmp dir - system wide
-   s = getenv("TMPDIR");
-   if (!s) s = getenv("TMP");
-   if (!s) s = getenv("TEMPDIR");
-   if (!s) s = getenv("TEMP");
-   if (!s) s = "/tmp";
+   s = eina_environment_tmp_get();
    efl_vpath_core_meta_set(obj, "tmp", s);
 
 #define ENV_HOME_SET(_env, _dir, _meta) \
@@ -90,6 +91,7 @@ _efl_vpath_core_eo_base_constructor(Eo *obj, 
Efl_Vpath_Core_Data *pd)
    //   be 0700.
    if (!(s = getenv("XDG_RUNTIME_DIR")))
      {
+#ifdef HAVE_GETUID
         struct stat st;
 
         // fallback - make ~/.run
@@ -110,6 +112,9 @@ _efl_vpath_core_eo_base_constructor(Eo *obj, 
Efl_Vpath_Core_Data *pd)
              if (stat(buf, &st) == 0) s = buf;
              else s = (char *)efl_vpath_core_meta_get(obj, "tmp");
           }
+#else
+       s = (char *)efl_vpath_core_meta_get(obj, "tmp");
+#endif
      }
    efl_vpath_core_meta_set(obj, "run", s);
    // https://www.freedesktop.org/wiki/Software/xdg-user-dirs/
@@ -248,6 +253,7 @@ _efl_vpath_core_efl_vpath_fetch(Eo *obj, 
Efl_Vpath_Core_Data *pd EINA_UNUSED, co
    // begins a fetch and on finish calls the event cb or when wait is called
    if (path)
      {
+        /* FIXME: not working for WIndows */
         // /* <- full path
         if (path[0] == '/')
           {

-- 


Reply via email to