public static String parent ( String file ) { if ( StringUtils . isNullOrBlank ( file ) ) { return StringUtils . EMPTY ; } file = StringUtils . trim ( file ) ; String path = path ( file ) ; int index = indexOfLastSeparator ( path ) ; if ( index <= 0 ) { return SystemInfo . isUnix ( ) ? Character . toString ( UNIX_SEPARATOR ) : Character . toString ( WINDOWS_SEPARATOR ) ; } return path . substring ( 0 , index ) ; }
Returns the parent directory for the given file . If the file passed in is actually a directory it will get the directory s parent .