Przeglądaj źródła

Added detail about why a file couldn't be opened (thanks mgerhardy!)

Fixes https://github.com/libsdl-org/SDL/issues/10484
Sam Lantinga 1 rok temu
rodzic
commit
1512013320
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      src/file/SDL_rwops.c

+ 2 - 1
src/file/SDL_rwops.c

@@ -36,6 +36,7 @@
 
 #ifdef HAVE_STDIO_H
 #include <stdio.h>
+#include <errno.h>
 #include <sys/stat.h>
 #endif
 #ifdef HAVE_LIMITS_H
@@ -632,7 +633,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
         FILE *fp = fopen(file, mode);
 #endif
         if (!fp) {
-            SDL_SetError("Couldn't open %s", file);
+            SDL_SetError("Couldn't open %s: %s", file, strerror(errno));
         } else if (!IsRegularFileOrPipe(fp)) {
             fclose(fp);
             fp = NULL;