Hello,

this patch adds some platform specific code for Darwin to retrieve the current 
working directory of the process in the active pane.

Alex


diff --git a/osdep-darwin.c b/osdep-darwin.c
index c5820df..7b15446 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -18,6 +18,7 @@

#include <sys/types.h>
#include <sys/sysctl.h>
+#include <libproc.h>

#include <event.h>
#include <stdlib.h>
@@ -52,6 +53,15 @@ osdep_get_name(int fd, unused char *tty)
char *
osdep_get_cwd(pid_t pid)
{
+       static char wd[PATH_MAX];
+       struct proc_vnodepathinfo pathinfo;
+       int ret;
+
+       ret = proc_pidinfo(pid, PROC_PIDVNODEPATHINFO, 0, &pathinfo, 
sizeof(pathinfo));
+       if (ret == sizeof(pathinfo)) {
+               strlcpy(wd, pathinfo.pvi_cdir.vip_path, sizeof(wd));
+               return (wd);
+       }
        return (NULL);
}
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to