Skip to content

Commit 1512013

Browse files
committed
Added detail about why a file couldn't be opened (thanks mgerhardy!)
Fixes libsdl-org#10484
1 parent 8f5d3ca commit 1512013

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/file/SDL_rwops.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#ifdef HAVE_STDIO_H
3838
#include <stdio.h>
39+
#include <errno.h>
3940
#include <sys/stat.h>
4041
#endif
4142
#ifdef HAVE_LIMITS_H
@@ -632,7 +633,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
632633
FILE *fp = fopen(file, mode);
633634
#endif
634635
if (!fp) {
635-
SDL_SetError("Couldn't open %s", file);
636+
SDL_SetError("Couldn't open %s: %s", file, strerror(errno));
636637
} else if (!IsRegularFileOrPipe(fp)) {
637638
fclose(fp);
638639
fp = NULL;

0 commit comments

Comments
 (0)