devilhorns pushed a commit to branch master. http://git.enlightenment.org/apps/express.git/commit/?id=0e044cd9cb2aa63c017590a9f8bf92589c43ddfe
commit 0e044cd9cb2aa63c017590a9f8bf92589c43ddfe Author: Chris Michael <cp.mich...@samsung.com> Date: Fri Aug 14 10:16:14 2015 -0400 express: Use getcwd instead of getting current working directory based on process id Signed-off-by: Chris Michael <cp.mich...@samsung.com> --- src/bin/utils.c | 47 +++++------------------------------------------ 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/src/bin/utils.c b/src/bin/utils.c index 18c5640..d767849 100644 --- a/src/bin/utils.c +++ b/src/bin/utils.c @@ -573,44 +573,6 @@ _homedir_get(char *buf, size_t size) return eina_strlcpy(buf, home, size) < size; } -Eina_Bool -_cwd_get(const Evas_Object *obj EINA_UNUSED, char *buf, size_t size) -{ - pid_t pid; - - pid = getpid(); - -#if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__)) - - struct proc_vnodepathinfo vpi; - - if (proc_pidinfo(pid, PROC_PIDVNODEPATHINFO, 0, &vpi, sizeof(vpi)) <= 0) - { - ERR(_("Could not get working directory of pid %i: %s"), - pid, strerror(errno)); - return EINA_FALSE; - } - memcpy(buf, vpi.pvi_cdir.vip_path, size); - -#else - - char procpath[PATH_MAX]; - ssize_t siz; - - snprintf(procpath, sizeof(procpath), "/proc/%d/cwd", pid); - if ((siz = readlink(procpath, buf, size)) < 1) - { - ERR("Could not load working directory %s: %s", - procpath, strerror(errno)); - return EINA_FALSE; - } - buf[siz] = 0; - -#endif - - return EINA_TRUE; -} - static char * _home_path_get(const Evas_Object *obj EINA_UNUSED, const char *relpath) { @@ -624,12 +586,13 @@ _home_path_get(const Evas_Object *obj EINA_UNUSED, const char *relpath) } static char * -_cwd_path_get(const Evas_Object *obj, const char *relpath) +_cwd_path_get(const char *relpath) { char cwdpath[PATH_MAX], tmppath[PATH_MAX]; + char *tmp = NULL; - if (!_cwd_get(obj, cwdpath, sizeof(cwdpath))) - return NULL; + tmp = getcwd(cwdpath, PATH_MAX); + if (!tmp) return NULL; eina_str_join(tmppath, sizeof(tmppath), '/', cwdpath, relpath); return strdup(tmppath); @@ -648,7 +611,7 @@ _util_local_path_get(const Evas_Object *obj, const char *relpath) else if (eina_str_has_prefix(relpath, "~/")) return _home_path_get(obj, relpath + 2); else - return _cwd_path_get(obj, relpath); + return _cwd_path_get(relpath); } Eina_Bool --