CuteAlien wrote:Why do I continue to say stupid stuff like "this should be simple to check"? I really should know better
There's more than one problem here. First - Irrlicht had a bug. Since Irrlicht 1.6 createFileList shouldn't have worked for virtual archives at all. I suppose no one used that or everyone gave up. Basically that tries to find all files in a folder - but it looked for folders in "/" instead of in "" for reasons which I obviously don't know as I wasn't involved yet back then.
I changed that now in svn trunk (r5359). Not much tests yet (as this wasn't tested...), so I hope I didn't break something else.
Fixing this - next problem is tar.gz archives. It should be supported, but so far I can't get it to work. Internally it checks certain bytes at the file-header to figure out if it's a tar.gz it supports - and that function returns false. Don't know the reason. If you use just .tar files instead those work now (didn't before fixing the thing above). But even if it works - it should probably need 2 archives. First one to open the .gz part. And then another one to open the .tar part (just guesssing here).
so.. EFAT_GZIP has a misleading name and should actually be EFAT_TAR?
CuteAlien wrote:Last things are 2 potential problems in your code as well. First using wprintf might - at least on Unix. Because Irrlicht logging uses printf - and Unix programs can't seem to handle a mix of those 2 functions so once a printf call was made the wprintf simply does nothing.
The other problem is your strArray. I don't see the type you use. But you pass a c_str() for a variable which changes on each loop. So if you have more than one result there ... you can get all kind of strange results as the pointers are constantly overwritten and point now... most likely to the last string, but in some situation even to completely wrong places in memory. That is - unless strArray contains a string-class (and not just char pointers) - but then you probably don't need the c_str() call.
printf can't print wide strings (i.e printf(L"") is a syntax error), that's the whole point of wprintf - if your implementation lets you that's a bug (strictly speaking printing a wide string with printf is undefined behavior, and a type mismatch)
As for printf/wprintf being mixed, that sounds more like a bug with the terminal emulator itself rather than mixing them being bad per se ('sides it's only used for my testing and works on the environments tested so that's really all that matters here) - the tl;dr reason here is, I don't rely on printf for anything other than debugging and won't fix potential platform bugs that don't affect me since I don't do debugging on those platforms (and if I do I can always write correct debug messages for those platforms if ever needed).
as for strArray, you're probably referring to this (since it's the only part that ever /writes/ to the array)
s is an irrlicht stringw type and it's only to cease the incessant warnings from the compiler.
strArray is just a temporary consisting of std::wstring type strings (i.e C++ strings with wide char support), the reason I use .c_str() varies but it ranges from silencing warnings to actually getting the correct data.
Presumably you may also refer to
Code: Select all
fs->addFileArchive(strArray[i].c_str(), false, false, EFAT_GZIP);
but in this case the concern is questionable since we're only reading the array, not writing to it