12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include <stdio.h>
- #include "physfs.h"
- int main(int argc, char **argv)
- {
- int rc = 0;
- if (!PHYSFS_init(argv[0]))
- {
- printf("PHYSFS_init() failed: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
- return 42;
- }
- rc = PHYSFS_addToSearchPath(argv[0], 0);
- if (!rc)
- {
- printf("Couldn't find self-extract data: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
- printf("This might mean you didn't append a zipfile to the binary.\n");
- return 42;
- }
- char **files = PHYSFS_enumerateFiles("/");
- char **i;
- for (i = files; *i != NULL; i++)
- {
- const char *dirorfile = PHYSFS_isDirectory(*i) ? "Directory" : "File";
- printf(" * %s '%s' is in root of attached data.\n", dirorfile, *i);
- }
- PHYSFS_freeList(files);
- return 0;
- }
|