-
Notifications
You must be signed in to change notification settings - Fork 187
Description
Currently asset file names and hence IDs generated from them have very little limitation, only those directly implied by asset loading system and OS Cubyz is currently running on. There are reasons to explicitly restrict certain characters from appearing in asset file names and hence IDs (completely or partially) to either use them for special purpose or to encourage cross-platform compatibility of assets.
In particular:
:- used to separate addon name from asset ID and to separate ID from block data%- used to separate weight from block ID inPattern- Add block pattern parsing #1237,- used to separatePatternsub-expressions - Add block pattern parsing #1237|- used to logically orEditMasksub-expression - Edit masks #1284&- used to logically andEditMasksub-expression - Edit masks #1284!- used to inverseEditMasksub-expression - Edit masks #1284$- used to indicate a tag inEditMask- Edit masks #1284@- used to indicate block property query inEditMask- Edit masks #1284#- used for adding colors to text in chat.,{,},=- to allow cleaner notation for block data. For example, for branches:cubyz:oak_branch:.{.posX = true, .negX = true}<,>,",\,|,/,:,?,*- characters not allowed in file names on Windows operating system- control characters in range 0 - 31 - again, characters not allowed in file names on Windows operating system
We can either refuse to register assets with those characters in file names or automatically replace those characters with some placeholder character like _. Latter option creates a small problem with handling of name collisions in auto-generated names, but we could in such case refuse to load the asset completely. Either way file names that do not comply with limitations should be reported to the user as std.log.err.
There is also list of reserved file names from Windows:
CON, PRN, AUX, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM¹, COM², COM³, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, LPT, LPT, and LPT
We can also consider restricting file name lenght to some sane limit, eg. 255 chars to match limitations of most file systems.