! Copyright (C) 2011 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: combinators io.pathnames kernel sequences system vocabs vocabs.platforms ; IN: io.standard-paths HOOK: find-native-bundle os ( string -- path ) 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 [ append-path ] [ 2drop f ] if ] if-empty ; : ?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 ; > prefix binary stream-contents parse-login-paths ; M: unix find-in-standard-login-path* [ standard-login-paths ] dip '[ _ append-path file-exists? ] find nip ; UNIX> array harvest members ; inline : find-in-program-files ( base-directory quot -- path ) [ program-files-directories ] [ '[ _ append-path ] map ] [ find-file-in-directories ] tri* ; inline M: windows find-in-applications >lower '[ [ >lower _ tail? ] find-in-program-files ] map-find drop ; M: windows find-in-path* [ "PATH" os-env ";" split ] dip '[ _ append-path file-exists? ] find nip ; WINDOWS>