ArchiveInfoList supportedArchiveTypes() { ArchiveInfoList list; for (const ArchiveInfo** archiveType = PHYSFS_supportedArchiveTypes(); *archiveType != NULL; archiveType++) { list.push_back(**archiveType); } return list; }
static void check_Physfs(void) { const PHYSFS_ArchiveInfo **i; bool zipfound = false; PHYSFS_Version compiled; PHYSFS_Version linked; PHYSFS_VERSION(&compiled); PHYSFS_getLinkedVersion(&linked); debug(LOG_WZ, "Compiled against PhysFS version: %d.%d.%d", compiled.major, compiled.minor, compiled.patch); debug(LOG_WZ, "Linked against PhysFS version: %d.%d.%d", linked.major, linked.minor, linked.patch); if (linked.major < 2) { debug(LOG_FATAL, "At least version 2 of PhysicsFS required!"); exit(-1); } for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++) { debug(LOG_WZ, "[**] Supported archive(s): [%s], which is [%s].", (*i)->extension, (*i)->description); if (!strncasecmp("zip", (*i)->extension, 3) && !zipfound) { zipfound = true; } } if (!zipfound) { debug(LOG_FATAL, "Your Physfs wasn't compiled with zip support. Please recompile Physfs with zip support. Exiting program."); exit(-1); } }
StringVector supportedArchiveTypes() { const PHYSFS_ArchiveInfo** lst = PHYSFS_supportedArchiveTypes(); StringVector list; for (; *lst != 0; ++lst) list.push_back((*lst)->extension); return list; // lst is static data, don't free }
/**Prints the current archives supported.*/ void Filesystem::OutputArchivers( void ){ const PHYSFS_ArchiveInfo **rc = PHYSFS_supportedArchiveTypes(); const PHYSFS_ArchiveInfo **i; LogMsg(INFO,"Supported archive types:\n"); if (*rc == NULL) LogMsg(INFO," * Apparently, NONE!\n"); else{ for (i = rc; *i != NULL; i++){ LogMsg(INFO," * %s: %s\n Written by %s.\n %s\n", (*i)->extension, (*i)->description, (*i)->author, (*i)->url); } } }
int main(int argc, char* argv[]) { PHYSFS_init(NULL); { PHYSFS_Version compiled; PHYSFS_Version linked; PHYSFS_VERSION(&compiled); PHYSFS_getLinkedVersion(&linked); printf("We compiled against PhysFS version %d.%d.%d ...\n", compiled.major, compiled.minor, compiled.patch); printf("But we linked against PhysFS version %d.%d.%d.\n", linked.major, linked.minor, linked.patch); } { const PHYSFS_ArchiveInfo** i; for(i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++) { printf("Supported archive: [%s], which is [%s].\n", (*i)->extension, (*i)->description); } } { char **cds = PHYSFS_getCdRomDirs(); char **i; for (i = cds; *i != NULL; i++) printf("cdrom dir [%s] is available.\n", *i); PHYSFS_freeList(cds); } { char **i; for (i = PHYSFS_getSearchPath(); *i != NULL; i++) printf("[%s] is in the search path.\n", *i); PHYSFS_freeList(i); } PHYSFS_deinit(); }
static void output_archivers(void) { const PHYSFS_ArchiveInfo **rc = PHYSFS_supportedArchiveTypes(); const PHYSFS_ArchiveInfo **i; printf("Supported archive types:\n"); if (*rc == NULL) printf(" * Apparently, NONE!\n"); else { for (i = rc; *i != NULL; i++) { printf(" * %s: %s\n Written by %s.\n %s\n", (*i)->extension, (*i)->description, (*i)->author, (*i)->url); } /* for */ } /* else */ printf("\n"); } /* output_archivers */
static void check_Physfs(void) { const PHYSFS_ArchiveInfo **i; bool zipfound = false; PHYSFS_Version compiled; PHYSFS_Version linked; PHYSFS_VERSION(&compiled); PHYSFS_getLinkedVersion(&linked); debug(LOG_WZ, "Compiled against PhysFS version: %d.%d.%d", compiled.major, compiled.minor, compiled.patch); debug(LOG_WZ, "Linked against PhysFS version: %d.%d.%d", linked.major, linked.minor, linked.patch); if (linked.major < 2) { debug(LOG_FATAL, "At least version 2 of PhysicsFS required!"); exit(-1); } if (linked.major == 2 && linked.minor == 0 && linked.patch == 2) { debug(LOG_ERROR, "You have PhysicsFS 2.0.2, which is buggy. You may experience random errors/crashes due to spuriously missing files."); debug(LOG_ERROR, "Please upgrade/downgrade PhysicsFS to a different version, such as 2.0.3 or 2.0.1."); } for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++) { debug(LOG_WZ, "[**] Supported archive(s): [%s], which is [%s].", (*i)->extension, (*i)->description); if (!strncasecmp("zip", (*i)->extension, 3) && !zipfound) { zipfound = true; } } if (!zipfound) { debug(LOG_FATAL, "Your Physfs wasn't compiled with zip support. Please recompile Physfs with zip support. Exiting program."); exit(-1); } }
// checks which archives are supported by PhysFS. Return 0 if some essential (HOG) is not supported int PHYSFSX_checkSupportedArchiveTypes() { const PHYSFS_ArchiveInfo **i; int hog_sup = 0, mvl_sup = 0; con_printf(CON_DEBUG, "PHYSFS: Checking supported archive types.\n"); for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++) { con_printf(CON_DEBUG, "PHYSFS: Supported archive: [%s], which is [%s].\n", (*i)->extension, (*i)->description); if (!stricmp((*i)->extension, "HOG")) hog_sup = 1; if (!stricmp((*i)->extension, "MVL")) mvl_sup = 1; } if (!hog_sup) con_printf(CON_CRITICAL, "PHYSFS: HOG not supported. The game will not work without!\n"); if (!mvl_sup) con_printf(CON_URGENT, "PHYSFS: MVL not supported. Won't be able to play movies!\n"); return hog_sup; }