FileList containing added archive files?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

FileList containing added archive files?

Post by stefbuet »

Hi,

I would like to make a filename list of files from all archives loaded in the Irrlicht FileSystem. However the "createFileList" function do not give any of the files contained in archives previously loaded, just other normal files...
Is there a way to acess to there archived files (get their filename)?

Thank a lot in advance,

Stef.
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Hi again,

I saw some other people having trouble with the same problem.

And here I can see that obviously this file system feature will come on 1.6 next release :(

However for those who want a file list of zipped files, I found something to manage to do this. A really little library, in fact more a peace of code witch allow you to do some basic operations on zip files, including retrieving some filenames.
You can get the code here :
http://www.codeproject.com/KB/files/zip_utils.aspx

And here is an exemple to show all files (filenames) of zip file on the console out :

Code: Select all


//getting all filenames from all zip archives (CMD display)
        IFileSystem *filesys=device->getFileSystem();
        IFileList *fileList=filesys->createFileList();
        for(u32 i=2; i<fileList->getFileCount(); i++) {
             string *filename=new std::string(fileList->getFileName(i));
             string *extention=new std::string(filename->substr(filename->length()-4,4));
             if(memcmp(extention->data(), ".zip", 4)==0) {
                     //we found a zip file, we're going to analyse it :
                     HZIP zipFile=OpenZip(filename->c_str(),0);
                     ZIPENTRY infos;
                     GetZipItem(zipFile, -1, &infos);
                     int itemCount=infos.index;
                     for(int i=0; i<itemCount; i++) {
                             ZIPENTRY zipFileEntry;
                             GetZipItem(zipFile, i, &zipFileEntry);
                             cout<<"archive file : "<<zipFileEntry.name<<endl;
                     }
                     
                          
             }
             
     }

Hope it will help some people!

Stef.

[/code]
Apoptyzm
Posts: 19
Joined: Tue Sep 23, 2008 7:53 pm

Post by Apoptyzm »

stefbuet wrote:

Code: Select all

             //std:string = irr::io::path
             string *filename=new std::string(fileList->getFileName(i));
How come this works? ? ?

I get C2664 in VS and its rather correct(?)
Post Reply