private String locateConfigFileName ( String configDir , String configFileName ) throws IOException { String curDir = new File ( "." ) . getCanonicalPath ( ) ; String path = null ; // Go for at most 10 levels up for ( int i = 0 ; i < 10 ; i ++ ) { path = String . format ( "%s/%s" , curDir , configFileName ) ; if ( Utils . localFileExists ( path ) ) break ; String dir = String . format ( "%s/%s" , curDir , configDir ) ; if ( Utils . dirExists ( dir ) ) { path = String . format ( "%s/%s" , dir , configFileName ) ; if ( Utils . localFileExists ( path ) ) break ; } curDir = String . format ( "%s/.." , curDir ) ; } mSource = path ; if ( Strings . isNullOrEmpty ( path ) ) throw new IOException ( String . format ( "Cannot locate DDF configuration file %s" , configFileName ) ) ; mLog . debug ( String . format ( "Using config file found at %s\n" , path ) ) ; return path ; }
Search in current dir and working up looking for the config file