I've been fooling around with this for a while trying to get it all to work but nothing seems to work.
How does the ordering and overlapping of files within archives work?
Say I add a folder and I add a zip file, both of these have the same file inside, different data. Does it choose the last loaded, first loaded, or both?
The zip archive has a texture in it that's the original, the folder has an image with the same name that's different. Now it doesn't matter which one of these lines I execute first, it will only select the files in the zip file. So I never get the modified version.
You should probably take a few minutes to look at the source code. I mean, you already have it on your machine and the answers you seek are in there for the taking.
Since I've alreay looked, I'll give you the answer. The createAndOpenFile() call looks through the .zip file systems [in the order they are added], then it looks through the .pak file systems [in the order they were added], then it looks through the folder file systems [in the order they were added], then it tries to create/open the file from the working directory.
So, in your example, you have <modname>.zip and a directory named <modname>. If you try to access image.jpg that is in the .zip and in the directory, it will give you back the one that is in the zip archive.
The order in which the files are to be loaded depend on the mod
default.zip
default/
<modname>.zip
<modname>/
So each consecutive add replace files that previously exist in the file archive. However say I add each of these in this order, if I try and find one of those textures when I'm in the /mod/ directory it will look for it in that directory, then it will go to the parent mapped directory and check that. I want it to have one list of files that get overwritten by others. (if you want them over written)
So all folders\zips can have texture.jpg, but only the last one loaded has the texture that is actually loaded.
I don't understand why this is a big issue. You want your plugin system to search for files in a specific way and Irrlicht doesn't do it that way. You have to write some code and probably rebuild the Irrlicht library. Simple as that.
First, you don't have to sound defensive about the topic. I was just asking about the process and if it were possible. Recompiling the library isn't a hassle, just pinpointing where the changes need to be made takes a little longer.
Am I to assume that all other classes in Irrlicht use CFileSystem::createAndOpenFile() as the main function for opening files?
Taking a look at this function it checks all zip files, then pak, then folders. But how does the current directory play in this scenario? For example I have data\default.zip and data\default\. When the current directory is set to data\default\ it prefers files from that folder over the zip file. But how can that be possible if it checks the zip files and returns an IReadFile before it does a createReadFile?
You would have to modify the Irrlicht engine to read from the directory first before reading from a file archive. As you saw, it reads from the archives in the order they were added, starting with zip, then pak, then "unzip". If the file is still not found, it reads from the current directory.
If you really want to read from the current directory first, here is the altered function in CFileSystem.cpp: