2011-10-30 18:13:50 -04:00
|
|
|
! Copyright (C) 2011 Doug Coleman.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2015-06-24 21:44:09 -04:00
|
|
|
USING: environment fry io io.encodings.utf8 io.files io.launcher
|
|
|
|
io.pathnames io.standard-paths kernel sequences splitting system ;
|
2011-10-30 18:13:50 -04:00
|
|
|
IN: io.standard-paths.unix
|
|
|
|
|
2011-10-31 14:53:07 -04:00
|
|
|
M: unix find-in-path*
|
2011-10-30 18:13:50 -04:00
|
|
|
[ "PATH" os-env ":" split ] dip
|
|
|
|
'[ _ append-path exists? ] find nip ;
|
|
|
|
|
2015-06-24 21:44:09 -04:00
|
|
|
: 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 ;
|