// ctor: input is filename to open. // only std::ios::in is supported currently. // if _makeGlobal == TRUE, then the ZipFile is added to the list // of global zip files. zppZipArchive::zppZipArchive(const std::string &_fn, std::ios::openmode _mode, bool _makeGlobal) { ourFile = false; zipName = _fn; canonizePath(zipName); #ifdef ZPP_INCLUDE_CRYPT passwd = NULL; #endif if (_mode & std::ios_base::in) { // make sure "binary" mode is selected. _mode |= std::ios_base::binary; #ifdef ZPP_USE_STDIO FILE *infile = fopen(zipName.c_str(),"rb"); current_pos_v=0; #else std::ifstream *infile = new std::ifstream(); infile->open(zipName.c_str(),_mode); #endif ourFile = true; #ifdef ZPP_USE_STDIO if (!infile) throw zppError("can't open zip file"); #else if (infile->fail()) throw zppError("can't open zip file"); #endif str = infile; } else { throw ("zppZipArchive:: only std::ios::in currently supported."); } priority = defaultPriority; isGlobal = _makeGlobal; // build internal data structures parseZipDirectory(); }