crownengine / crown

The flexible game engine.
https://www.crownengine.org
Other
2.1k stars 152 forks source link

added check for duplicate extensions #143

Closed SeanKuehl closed 1 year ago

SeanKuehl commented 1 year ago

Added a basic check for duplicate extensions to prevent the duplicate "png" issue#131 previously reported.

dbartolini commented 1 year ago

This does not prevent duplicated entries in _all_extensions_importer_data.extensions, just avoids adding duplicated entries from data. For example, the following code will still produce duplicates:

register_importer("Sprite", { "png" }, SpriteResource.import, 0.0);
register_importer("Texture", { "png", "tga", "dds", "ktx", "pvr" }, TextureResource.import, 2.0); 
SeanKuehl commented 1 year ago

I see the register_importer function. I only did the register_importer_internal. If I add a similar approach to register_importer will this fix the issue? I would test this myself but I've had issues trying to build Crown myself. I've asked a question in the Discord but haven't heard back yet.

SeanKuehl commented 1 year ago

I've changed the loop to check for duplicates in all_extensions and add only unique ones.