]> gitweb.factorcode.org Git - factor.git/blob - basis/io/standard-paths/standard-paths.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / io / standard-paths / standard-paths.factor
1 ! Copyright (C) 2011 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators io.pathnames kernel sequences system
4 vocabs ;
5 IN: io.standard-paths
6
7 HOOK: find-native-bundle os ( string -- path )
8
9 HOOK: find-in-path* os ( string -- path/f )
10
11 HOOK: find-in-applications os ( directories filename -- path )
12
13 HOOK: find-in-standard-login-path* os ( string -- path/f )
14
15 M: object find-in-standard-login-path*
16     find-in-path* ;
17
18 : find-in-path ( string -- path/f )
19     [ f ] [
20         [ find-in-path* ] keep over
21         [ append-path ] [ 2drop f ] if
22     ] if-empty ;
23
24 : ?find-in-path ( string -- path/string )
25     [ find-in-path ] [ or ] bi ;
26
27 : find-in-standard-login-path ( string -- path/f )
28     [ f ] [
29         [ find-in-standard-login-path* ] keep over
30         [ append-path ] [ 2drop f ] if
31     ] if-empty ;
32
33 {
34     { [ os windows? ] [ "io.standard-paths.windows" ] }
35     { [ os macosx? ] [ "io.standard-paths.macosx" ] }
36     { [ os unix? ] [ "io.standard-paths.unix" ] }
37 } cond require