Skip to content

ID / asset file name limitations #1285

@Argmaster

Description

@Argmaster

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 in Pattern - Add block pattern parsing #1237
  • , - used to separate Pattern sub-expressions - Add block pattern parsing #1237
  • | - used to logically or EditMask sub-expression - Edit masks #1284
  • & - used to logically and EditMask sub-expression - Edit masks #1284
  • ! - used to inverse EditMask sub-expression - Edit masks #1284
  • $ - used to indicate a tag in EditMask - Edit masks #1284
  • @ - used to indicate block property query in EditMask - 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething isn't working in the intended waymanagementthings not related to the game itself, but rather the processes and management structures

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions