Bug Description:
Structure blocks use FileUtils#isPathPortable to check if the path to where a structure file will be saved is valid, but the method checks improperly and returns false for valid paths. Currently, the method uses this regex:
.*\.|(?:COM|CLOCK\$|CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\..*)?
This regex is checked on every section of the path but it does not check it properly, it will currently match if a directory is named com.example for example this is a valid directory on Windows this is because it checks if it starts with com. when it should be checking if it starts with com0. instead, in addition to this it also does not check if it is lpt0 or com0 instead checks com[1-9] and lpt[1-9] which means it allows both through when both are also invalid file names on Windows.
Steps to Reproduce:
Create a directory named com.example anywhere on your system
Create a Minecraft installation using that directory as the game directory
Start and join a world
Give yourself a structure block
Try to save a structure
Notice that it will be unable to save
A regex that is more correct and covers some missing reserved names is this:
.\.|(?:CON|PRN|AUX|NUL|CLOCK\$|CONIN\$|CONOUT\$|(?:COM|LPT)[¹²³0-9])(?:\..)?
Would be ideal if this is used instead or a form of it.