boolean (@NotNull String ancestor, @NotNull String path, boolean caseSensitive) { if (caseSensitive) { if (!path.startsWith(ancestor)) return false; } else { if (!StringUtil.startsWithIgnoreCase(path, ancestor)) return false; } return ancestor.length() == path.length() || path.charAt(ancestor.length()) == '/'; }