[fixed]problem with addFileArchive

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
ngc92
Posts: 11
Joined: Thu Nov 19, 2009 3:56 pm

[fixed]problem with addFileArchive

Post 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?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: problem with addFileArchive

Post by hybrid »

Hmm, I'll add a test case for this. Probably some path handling problem with '.'
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

Re: problem with addFileArchive

Post by Iyad »

Meanwhile, try to simply use "../Myfolder"
#include <Iyad.h>
ngc92
Posts: 11
Joined: Thu Nov 19, 2009 3:56 pm

Re: problem with addFileArchive

Post 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)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: problem with addFileArchive

Post 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.
ngc92
Posts: 11
Joined: Thu Nov 19, 2009 3:56 pm

Re: problem with addFileArchive

Post 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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: problem with addFileArchive

Post 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.


Last bumped by hybrid on Sat Sep 10, 2011 10:21 am.
Post Reply