private static InputStream getCowFromCowPath ( final String cowName ) { String cowPath = System . getenv ( "COWPATH" ) ; if ( cowPath != null ) { String [ ] paths = cowPath . split ( File . pathSeparator ) ; if ( paths != null ) { for ( String path : paths ) { File cowfile = getCowfile ( path , cowName ) ; if ( cowfile != null ) { return cowfileToCowInputStream ( cowfile ) ; } } } } return getCowFromResources ( cowName ) ; }
This will attempt to load a cowfile by name from the COWPATH environment variable or bundled cowfiles . Note that bundled cowfiles are considered part of the COWPATH since this is how to original cowsay worked . COWPATH takes precedence and bundled cowfiles are only considered after searching the COWPATH .