misc/libphyslayer/hwpacksmounter.c
changeset 8978 e6ef8fe314bd
parent 8714 ab201a62d115
child 13393 ae5d6448c5be
equal deleted inserted replaced
8977:d424c7f8b342 8978:e6ef8fe314bd
    31             }
    31             }
    32     }
    32     }
    33 
    33 
    34     PHYSFS_freeList(filesList);
    34     PHYSFS_freeList(filesList);
    35 }
    35 }
       
    36 
       
    37 PHYSFS_DECL void hedgewarsMountPackage(char * fileName)
       
    38 {
       
    39     int fileNameLength = strlen(fileName);
       
    40     if (fileNameLength > 4)
       
    41         if (strcmp(fileName + fileNameLength - 4, ".hwp") == 0)
       
    42         {
       
    43             const char * dir = PHYSFS_getRealDir(fileName);
       
    44             if(dir)
       
    45             {
       
    46                 char * fullPath = (char *)malloc(strlen(dir) + fileNameLength + 2);
       
    47                 strcpy(fullPath, dir);
       
    48                 strcat(fullPath, "/");
       
    49                 strcat(fullPath, fileName);
       
    50 
       
    51                 PHYSFS_mount(fullPath, NULL, 0);
       
    52 
       
    53                 free(fullPath);
       
    54             }
       
    55         }
       
    56 }