Page 1 of 1

[fixed]problem with addFileArchive

Posted: Sat Jul 16, 2011 7:47 pm
by ngc92
Hello,

when i use addFileArchive I get the error message
"could not create archive for: ..."
even if I try

Code: Select all

device->getFileSystem()->addFileArchive(".", true, true, io::EFAT_FOLDER);
which obviously should work, as the folder "." exists.

I used this functionality already in an older project (before the FileSystem was renewed) and everything worked fine.

Any idea why this problems occur?

Re: problem with addFileArchive

Posted: Sat Jul 16, 2011 9:24 pm
by hybrid
Hmm, I'll add a test case for this. Probably some path handling problem with '.'

Re: problem with addFileArchive

Posted: Sat Jul 16, 2011 9:30 pm
by Iyad
Meanwhile, try to simply use "../Myfolder"

Re: problem with addFileArchive

Posted: Sun Jul 17, 2011 5:10 pm
by ngc92
sorry for the misunderstanding
i didn't mean the "." could not be added as search folder, i meant that i could not add any folder, even "." which surely exists.

it seems to be a problem with adding folders...
if i zip the folder and add the archive, everything works fine.

a minimal example would be this:

Code: Select all

 
#include <irrlicht.h>
using namespace irr;
 
int main() {
        IrrlichtDevice* device = createDevice(video::EDT_NULL);
        
        device->getFileSystem()->addFileArchive("gfx", true, true);
        device->getFileSystem()->addFileArchive("gfx.zip", true, true);
}
 
letting it run in a folder which contains a gfx subfolder and a gfx.zip file, this creates an error for opening the folder but works fine for the archive.

I am using Win XP with MingW GCC (mingw32-g++.exe (TDM-2 mingw32) 4.4.1)

Re: problem with addFileArchive

Posted: Tue Jul 19, 2011 8:06 pm
by hybrid
Well, we have a test case which adds a file folder, and runs properly. So there seems to be something different here. In general, addArchive for folders works.

Re: problem with addFileArchive

Posted: Wed Jul 20, 2011 8:32 am
by ngc92
hello,
i know now why the code shown above does not work:
in irrlichts addFileArchive function, it is tested for every loader whether it is able to load a that path. this function for CArchiveLoaderMount does the test like:
deletePathFromFilename and test whether filename ist empty, if yes, it can be loaded.
but "gfx" stays "gfx", so it thinks it tries to open a file. trying to open "gfx/" works fine.

is this desired behaviour? otherwise, i would recommend adapting the test in a way that CArchiveLoaderMount also tries to open all paths without a filename extension.

Re: problem with addFileArchive

Posted: Sat Sep 10, 2011 10:21 am
by hybrid
Well, this is a known limitation, but it should already be documented in the API.
Edit: Seems it was not documented, I have added a comment on adding directories as archives now.