diff -r 1dedcc37bfe8 -r 1853628ae285 misc/libphysfs/extras/hwpacksmounter.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libphysfs/extras/hwpacksmounter.c Fri Feb 22 05:15:48 2013 +0100 @@ -0,0 +1,35 @@ +#include +#include +#include + +#include "hwpacksmounter.h" + +PHYSFS_DECL void hedgewarsMountPackages() +{ + char ** filesList = PHYSFS_enumerateFiles("/"); + char **i; + + for (i = filesList; *i != NULL; i++) + { + char * fileName = *i; + int fileNameLength = strlen(fileName); + if (fileNameLength > 4) + if (strcmp(fileName + fileNameLength - 4, ".hwp") == 0) + { + const char * dir = PHYSFS_getRealDir(fileName); + if(dir) + { + char * fullPath = (char *)malloc(strlen(dir) + fileNameLength + 2); + strcpy(fullPath, dir); + strcat(fullPath, "/"); + strcat(fullPath, fileName); + + PHYSFS_mount(fullPath, NULL, 1); + + free(fullPath); + } + } + } + + PHYSFS_freeList(filesList); +}