public static String getParentPath ( String path ) { String parentPath = null ; if ( StringUtils . isEmpty ( path ) ) { parentPath = "" ; } else { parentPath = path ; if ( parentPath . length ( ) > 1 && parentPath . endsWith ( JawrConstant . URL_SEPARATOR ) ) { parentPath = parentPath . substring ( 0 , parentPath . length ( ) - 2 ) ; } int index = parentPath . lastIndexOf ( JawrConstant . URL_SEPARATOR ) ; if ( index > 0 ) { return parentPath . substring ( 0 , index + 1 ) ; } else { parentPath = JawrConstant . URL_SEPARATOR ; } } return parentPath ; }
Determines the parent path of a filename or a directory .