jodd-core/src/main/java/jodd/io/FileNameUtil.java
private static String doGetPath(final String filename, final int separatorAdd) {
		if (filename == null) {
			return null;
		}
		int prefix = getPrefixLength(filename);
		if (prefix < 0) {
			return null;
		}
		int index = indexOfLastSeparator(filename);
        int endIndex = index + separatorAdd;
        if (prefix >= filename.length() || index < 0 || prefix >= endIndex) {
			return StringPool.EMPTY;
		}
        return filename.substring(prefix, endIndex);
	}
private static String doGetPath(final String filename, final int separatorAdd) {
		if (filename == null) {
			return null;
		}
		int prefix = getPrefixLength(filename);
		if (prefix < 0) {
			return null;
		}
		int index = indexOfLastSeparator(filename);
        int endIndex = index + separatorAdd;
        if (prefix >= filename.length() || index < 0 || prefix >= endIndex) {
			return StringPool.EMPTY;
		}
        return filename.substring(prefix, endIndex);
	}
Does the work of getting the path.

@param filename  the filename
@param separatorAdd  0 to omit the end separator, 1 to return it
@return the path