StringList getCdRomDirs() { StringList dirs; char ** dirBegin = PHYSFS_getCdRomDirs(); for (char ** dir = dirBegin; *dir != NULL; dir++) { dirs.push_back(*dir); } PHYSFS_freeList(dirBegin); return dirs; }
StringVector getCdRomDirs() { StringVector list; char** lst = PHYSFS_getCdRomDirs(); for (char** l = lst; *l != 0; ++l) list.push_back(*l); PHYSFS_freeList(lst); return list; }
static int cmd_getcdromdirs(char *args) { char **rc = PHYSFS_getCdRomDirs(); (void)args; if (rc == NULL) printf("Failure. Reason: [%s].\n", PHYSFS_getLastError()); else { int dir_count; char **i; for (i = rc, dir_count = 0; *i != NULL; i++, dir_count++) printf("%s\n", *i); printf("\n total (%d) drives.\n", dir_count); PHYSFS_freeList(rc); } /* else */ return(1); } /* cmd_getcdromdirs */
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(); }