From 9d2c641a99f35f5176f017df3a4577dfc984953d Mon Sep 17 00:00:00 2001
From: Doug Coleman <doug.coleman@gmail.com>
Date: Wed, 24 Jun 2015 18:44:09 -0700
Subject: [PATCH] io.standard-paths: On mac when you launch Factor from the doc
 it doesn't have the login shell PATH variable for paths such as
 /usr/local/bin for homebrew. Add a word that finds things in this path as
 well. Note that launching a binary found this way needs the full path, as the
 PATH variable itself is not modified and the binary will still not be in PATH
 if it wasnt before.

---
 basis/io/standard-paths/standard-paths.factor | 11 +++++++++++
 basis/io/standard-paths/unix/unix.factor      | 10 ++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/basis/io/standard-paths/standard-paths.factor b/basis/io/standard-paths/standard-paths.factor
index 5aac58a1fe..d552af0657 100644
--- a/basis/io/standard-paths/standard-paths.factor
+++ b/basis/io/standard-paths/standard-paths.factor
@@ -10,6 +10,11 @@ HOOK: find-in-path* os ( string -- path/f )
 
 HOOK: find-in-applications os ( directories filename -- path )
 
+HOOK: find-in-standard-login-path* os ( string -- path/f )
+
+M: object find-in-standard-login-path*
+    find-in-path* ;
+
 : find-in-path ( string -- path/f )
     [ f ] [
         [ find-in-path* ] keep over
@@ -19,6 +24,12 @@ HOOK: find-in-applications os ( directories filename -- path )
 : ?find-in-path ( string -- path/string )
     [ find-in-path ] [ or ] bi ;
 
+: find-in-standard-login-path ( string -- path/f )
+    [ f ] [
+        [ find-in-standard-login-path* ] keep over
+        [ append-path ] [ 2drop f ] if
+    ] if-empty ;
+
 {
     { [ os windows? ] [ "io.standard-paths.windows" ] }
     { [ os macosx? ] [ "io.standard-paths.macosx" ] }
diff --git a/basis/io/standard-paths/unix/unix.factor b/basis/io/standard-paths/unix/unix.factor
index eaed43fc4c..bc37783b33 100644
--- a/basis/io/standard-paths/unix/unix.factor
+++ b/basis/io/standard-paths/unix/unix.factor
@@ -1,10 +1,16 @@
 ! Copyright (C) 2011 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: environment fry io.files io.pathnames io.standard-paths
-kernel sequences splitting system ;
+USING: environment fry io io.encodings.utf8 io.files io.launcher
+io.pathnames io.standard-paths kernel sequences splitting system ;
 IN: io.standard-paths.unix
 
 M: unix find-in-path*
     [ "PATH" os-env ":" split ] dip
     '[ _ append-path exists? ] find nip ;
 
+: standard-login-paths ( -- strings )
+    { "bash" "-l" "-c" "echo $PATH" }
+    utf8 <process-reader> stream-contents ":" split ;
+
+M: unix find-in-standard-login-path*
+    [ standard-login-paths ] dip '[ _ append-path exists? ] find nip ;