src/filesystem/unix/SDL_sysfilesystem.c
changeset 7695 47d12c248988
parent 7694 7f965b1a24e0
child 7697 678f71df2c6b
equal deleted inserted replaced
7694:7f965b1a24e0 7695:47d12c248988
   171         if (!envr) {
   171         if (!envr) {
   172             /* we could take heroic measures with /etc/passwd, but oh well. */
   172             /* we could take heroic measures with /etc/passwd, but oh well. */
   173             SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set");
   173             SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set");
   174             return NULL;
   174             return NULL;
   175         }
   175         }
   176         append = ".local/share/";
   176         if (envr[SDL_strlen(envr) - 1] == '/') {
       
   177             append = ".local/share/";
       
   178         } else {
       
   179             append = "/.local/share/";
       
   180         }
       
   181     } else {
       
   182         if (envr[SDL_strlen(envr) - 1] == '/') {
       
   183             append = "";
       
   184         }
   177     } /* if */
   185     } /* if */
   178 
   186 
   179     len = SDL_strlen(envr) + SDL_strlen(append) + SDL_strlen(app) + 2;
   187     len = SDL_strlen(envr) + SDL_strlen(append) + SDL_strlen(app) + 2;
   180     retval = (char *) SDL_malloc(len);
   188     retval = (char *) SDL_malloc(len);
   181     if (!retval) {
   189     if (!retval) {