Efter en snak med Ian og de andre OE gutterer vi begyndt at lave lidt om på ResourceManageren i selve OpenEngine, da den har nogle uhensigtmessige design valg.
Kort nævnt er det:
Der er kun et plugin pr file extension. Der er desværre ikke muligt at bruge et plugin på flere forskellige file extensions.
Pt har ResourceManageren kun en data path. Her kunne det være rart at have en form for PATH variabel som bestod af flere muligheder for søge stier.
[UPDATE] 28.11.07
We have updated both the IResourcePlugin class and the ResourceManager class to get the above results right.
The IResourcePlugin class/interface was extended with a list
of the extensions this plugin knows how to handle. The idea is that when creating a new plugin you add the extensions that this plugin should handle. A plugin can be asked if it AcceptsExtension.
This is used in the ResourceManager to replace the map to just list. Given a file we just look through all plugins and ask if this plugin AcceptsExtension of the given file. So first task completed.
Next we needed to have a path system. We can AppendPath and PrependPath. The ResouceManager just keeps a list of these path elements. The important part is the function FindFileInPath that given a filename looks in the paths list and uses boost::filesystem::exists to determine if that filename exists somewhere. It returns the empty string if not found and the absolute/relative fullpath of the file.
Ingen kommentarer:
Send en kommentar