Hello,
(I don’t know if this is still a topic, because I’m currently still using 3.0, making my font library.)
I once read in the source code, that resources like “.skeleton.xml” are being treated as a special case. I encountered the same problem, and found a very simple solution to it:
I have a list of well-known file extensions, that I put in a TreeMap which has a special comparator (see code snippet below). Then, I always check the end of a Path String (after using ‘normalize’ or ‘toRealPath’ - so I can be sure, that the only dots in the path string are for file extensions).
Here is the little comparator, used to foreach a TreeMap in order to find file extensions in the map:
//This comparator is mainly used to sort file extension from longest to shortest
// example: { ".mesh.skeleton.xml", ".font.zip", ".xml", ".zip" }
public static final Comparator<String> LONGEST_STRING_FIRST_COMPARATOR = new Comparator<String>()
{
@Override
public int compare(String o1, String o2)
{
if((o1 == null)||(o2 == null)) throw new IllegalArgumentException("o1 and o2 must not be null!");
if(o1.length() > o2.length())
return -1;
if(o1.length() < o2.length())
return 1;
return o1.compareTo(o2);
}
};
I know, it’s no big deal, but I often like to use such file extensions with two dots. Maybe others might find this little trick interesting.
And one could solve this problem in numerous ways - for example by having a data structure like [".xml"]->{ [".skeleton.xml"], [".mesh.xml"], … } and then trying to walk in this structure as far as possible.