src/filesystem/unix/SDL_sysfilesystem.c
changeset 7883 62f562a475e1
parent 7719 31b5f9ff36ca
child 8093 b43765095a6f
equal deleted inserted replaced
7882:b81e4cc2932e 7883:62f562a475e1
   176 
   176 
   177     len = SDL_strlen(envr);
   177     len = SDL_strlen(envr);
   178     if (envr[len - 1] == '/')
   178     if (envr[len - 1] == '/')
   179         append += 1;
   179         append += 1;
   180 
   180 
   181     len += SDL_strlen(append) + SDL_strlen(app) + 2;
   181     len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
   182     retval = (char *) SDL_malloc(len);
   182     retval = (char *) SDL_malloc(len);
   183     if (!retval) {
   183     if (!retval) {
   184         SDL_OutOfMemory();
   184         SDL_OutOfMemory();
   185         return NULL;
   185         return NULL;
   186     }
   186     }
   187 
   187 
   188     SDL_snprintf(retval, len, "%s%s%s/", envr, append, app);
   188     SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app);
   189 
   189 
   190     for (ptr = retval+1; *ptr; ptr++) {
   190     for (ptr = retval+1; *ptr; ptr++) {
   191         if (*ptr == '/') {
   191         if (*ptr == '/') {
   192             *ptr = '\0';
   192             *ptr = '\0';
   193             if (mkdir(retval, 0700) != 0 && errno != EEXIST)
   193             if (mkdir(retval, 0700) != 0 && errno != EEXIST)