protected final boolean tryCP ( String directory ) { String [ ] cp = StringUtils . split ( System . getProperty ( "java.class.path" ) , File . pathSeparatorChar ) ; for ( String s : cp ) { if ( ! StringUtils . endsWith ( s , ".jar" ) && ! StringUtils . startsWith ( s , "/" ) ) { String path = s + File . separator + directory ; File file = new File ( path ) ; if ( this . testDirectory ( file ) == true ) { //found using class path try { this . url = file . toURI ( ) . toURL ( ) ; this . file = file ; this . fullDirectoryName = FilenameUtils . getPath ( file . getAbsolutePath ( ) ) ; this . setRootPath = directory ; return true ; } catch ( MalformedURLException e ) { this . errors . addError ( "init() - malformed URL for file with name " + this . file . getAbsolutePath ( ) + " and message: " + e . getMessage ( ) ) ; } } } } return false ; }
Try to locate a directory using any directory given in the class path as set - root .