Christoph Mallon: Report an error, if creating the directories in SDL_GetPrefPath() failed.
parent
db7c92b4b4
commit
67c10169ee
|
@ -25,6 +25,8 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
/* System dependent filesystem routines */
|
/* System dependent filesystem routines */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -190,11 +192,17 @@ SDL_GetPrefPath(const char *org, const char *app)
|
||||||
for (ptr = retval+1; *ptr; ptr++) {
|
for (ptr = retval+1; *ptr; ptr++) {
|
||||||
if (*ptr == '/') {
|
if (*ptr == '/') {
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
mkdir(retval, 0700);
|
if (mkdir(retval, 0700) != 0 && errno != EEXIST)
|
||||||
|
goto error;
|
||||||
*ptr = '/';
|
*ptr = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mkdir(retval, 0700);
|
if (mkdir(retval, 0700) != 0 && errno != EEXIST) {
|
||||||
|
error:
|
||||||
|
SDL_SetError("Couldn't create directory '%s': ", retval, strerror(errno));
|
||||||
|
SDL_free(retval);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue