Hi,
I store map data in an archive 'mapname.zip'
the archive contains:
-mapname.bmp
-mapname.txt
-and a few other files
all these zip files are in a folder \maps
how can i acces them?
i need a function to display all the possible maps to choose from (all the zip files in \maps) and when you select one i need to load the files in the archive to ram
any idea how to do this?
i've messed around endlessly with addZipFileArchive but i can't solve it
thanks in advance
zip archive
First you create an IFileList (IFileSystem::createFilelist) of the folder where the map archives are stored. Then you can go through every file in the folder and check if it is a valid map file (maybe check the extension). Then if the users selects a map you can access it via its name and add it to the filesystem using IFileSystem::addZipFileArchive(). Then you can open the map data with IFileSystem::createAndOpenFile( "mapname.txt" )
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Code: Select all
FileSystem->changeWorkingDirectoryTo( "path/to/maps" );
IFileList* fileList = FileSystem->createFileList();
for( u32 i=0; i<fileList->getFileCount(); ++i)
{
stringc fileName = fileList->getFileName( i );
// fileName now contains the name of a file in the folder
}
fileList->drop();
Code: Select all
FileSystem->addZipFileArchive( "path/to/maps/maparchive.zip" );
IReadFile* mapnameTxt = FileSystem->createAndOpenFile( "mapname.txt" );
// read the file
mapnameTxt->drop();
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.