protected String determineRootDir(String location) {
        int prefixEnd = location.indexOf(':') + 1;
        int rootDirEnd = location.length();
        while (rootDirEnd > prefixEnd && getPathMatcher().isPattern(location.substring(prefixEnd, rootDirEnd))) {
            rootDirEnd = location.lastIndexOf('/', rootDirEnd - 2) + 1;
        }
        if (rootDirEnd == 0) {
            rootDirEnd = prefixEnd;
        }
        return location.substring(0, rootDirEnd);
    }
Determine the root directory for the given location.
<p>Used for determining the starting point for file matching,
resolving the root directory location to a {@code java.io.File}
and passing it into {@code retrieveMatchingFiles}, with the
remainder of the location as pattern.
<p>Will return "/WEB-INF/" for the pattern "/WEB-INF/*.xml",
for example.

@param location the location to check
@return the part of the location that denotes the root directory
see #retrieveMatchingFiles
analyzer/src/main/java/nl/basjes/parse/useragent/utils/springframework/core/io/support/PathMatchingResourcePatternResolver.java