platform/macclassic.c
changeset 162 06ed1dc94f73
parent 158 ecc4a7f173c1
child 166 ed10fe7cb16e
equal deleted inserted replaced
161:4fcc863fdc5f 162:06ed1dc94f73
    21 #include <Processes.h>
    21 #include <Processes.h>
    22 #include <Files.h>
    22 #include <Files.h>
    23 #include <TextUtils.h>
    23 #include <TextUtils.h>
    24 #include <Resources.h>
    24 #include <Resources.h>
    25 #include <MacMemory.h>
    25 #include <MacMemory.h>
       
    26 #include <Events.h>
    26 #endif
    27 #endif
    27 
    28 
    28 #define __PHYSICSFS_INTERNAL__
    29 #define __PHYSICSFS_INTERNAL__
    29 #include "physfs_internal.h"
    30 #include "physfs_internal.h"
    30 
    31 
   182 
   183 
   183 char *__PHYSFS_platformCvtToDependent(const char *prepend,
   184 char *__PHYSFS_platformCvtToDependent(const char *prepend,
   184                                       const char *dirName,
   185                                       const char *dirName,
   185                                       const char *append)
   186                                       const char *append)
   186 {
   187 {
   187     BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
   188     int len = ((prepend) ? strlen(prepend) : 0) +
       
   189               ((append) ? strlen(append) : 0) +
       
   190               strlen(dirName) + 1;
       
   191     const char *src;
       
   192     char *dst;
       
   193     char *retval = malloc(len);
       
   194     BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
       
   195 
       
   196     if (prepend != NULL)
       
   197     {
       
   198         strcpy(retval, prepend);
       
   199         dst = retval + strlen(retval);
       
   200     } /* if */
       
   201     else
       
   202     {
       
   203         *retval = '\0';
       
   204         dst = retval;
       
   205     } /* else */
       
   206 
       
   207     for (src = dirName; *src; src++, dst++)
       
   208         *dst = ((*src == '/') ? ':' : *src);
       
   209 
       
   210     *dst = '\0';
       
   211     return(retval);
   188 } /* __PHYSFS_platformCvtToDependent */
   212 } /* __PHYSFS_platformCvtToDependent */
   189 
   213 
   190 
   214 
   191 /* Much like my college days, try to sleep for 10 milliseconds at a time... */
       
   192 void __PHYSFS_platformTimeslice(void)
   215 void __PHYSFS_platformTimeslice(void)
   193 {
   216 {
       
   217     SystemTask();
   194 } /* __PHYSFS_platformTimeslice */
   218 } /* __PHYSFS_platformTimeslice */
   195 
   219 
   196 
   220 
   197 LinkedStringList *__PHYSFS_platformEnumerateFiles(const char *dirname,
   221 LinkedStringList *__PHYSFS_platformEnumerateFiles(const char *dirname,
   198                                                   int omitSymLinks)
   222                                                   int omitSymLinks)
   201 } /* __PHYSFS_platformEnumerateFiles */
   225 } /* __PHYSFS_platformEnumerateFiles */
   202 
   226 
   203 
   227 
   204 char *__PHYSFS_platformCurrentDir(void)
   228 char *__PHYSFS_platformCurrentDir(void)
   205 {
   229 {
   206     BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL);
   230     /*
       
   231      * I don't think MacOS has a concept of "current directory", beyond
       
   232      *  what is grafted on by a given standard C library implementation,
       
   233      *  so just return the base dir.
       
   234      * We don't use this for anything crucial at the moment anyhow.
       
   235      */
       
   236     return(__PHYSFS_platformCalcBaseDir(NULL));
   207 } /* __PHYSFS_platformCurrentDir */
   237 } /* __PHYSFS_platformCurrentDir */
   208 
   238 
   209 
   239 
   210 char *__PHYSFS_platformRealPath(const char *path)
   240 char *__PHYSFS_platformRealPath(const char *path)
   211 {
   241 {