2011-10-30 18:13:50 -04:00
|
|
|
! Copyright (C) 2011 Doug Coleman.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: combinators io.pathnames kernel sequences system
|
2011-11-02 14:23:41 -04:00
|
|
|
vocabs ;
|
2011-10-30 18:13:50 -04:00
|
|
|
IN: io.standard-paths
|
|
|
|
|
|
|
|
HOOK: find-native-bundle os ( string -- path )
|
|
|
|
|
2011-10-31 14:53:07 -04:00
|
|
|
HOOK: find-in-path* os ( string -- path/f )
|
2011-10-30 18:13:50 -04:00
|
|
|
|
2011-10-31 14:53:07 -04:00
|
|
|
HOOK: find-in-applications os ( directories filename -- path )
|
|
|
|
|
2015-06-24 21:44:09 -04:00
|
|
|
HOOK: find-in-standard-login-path* os ( string -- path/f )
|
|
|
|
|
|
|
|
M: object find-in-standard-login-path*
|
|
|
|
find-in-path* ;
|
|
|
|
|
2011-10-31 14:53:07 -04:00
|
|
|
: find-in-path ( string -- path/f )
|
2015-06-01 17:26:38 -04:00
|
|
|
[ f ] [
|
|
|
|
[ find-in-path* ] keep over
|
|
|
|
[ append-path ] [ 2drop f ] if
|
|
|
|
] if-empty ;
|
|
|
|
|
|
|
|
: ?find-in-path ( string -- path/string )
|
|
|
|
[ find-in-path ] [ or ] bi ;
|
2011-10-30 18:13:50 -04:00
|
|
|
|
2015-06-24 21:44:09 -04:00
|
|
|
: find-in-standard-login-path ( string -- path/f )
|
|
|
|
[ f ] [
|
|
|
|
[ find-in-standard-login-path* ] keep over
|
|
|
|
[ append-path ] [ 2drop f ] if
|
|
|
|
] if-empty ;
|
|
|
|
|
2014-11-15 17:25:12 -05:00
|
|
|
{
|
|
|
|
{ [ os windows? ] [ "io.standard-paths.windows" ] }
|
|
|
|
{ [ os macosx? ] [ "io.standard-paths.macosx" ] }
|
|
|
|
{ [ os unix? ] [ "io.standard-paths.unix" ] }
|
|
|
|
} cond require
|