shithub: choc

Download patch

ref: ff95b3ad95fd25d49e587e9d402cae67bab2e95d
parent: 7c2a5dfb1bac2eb0272d027e357229600d077292
author: Simon Howard <fraggle@gmail.com>
date: Wed Aug 8 14:03:32 EDT 2007

Make M_FileExists work on directories.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 949

--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <errno.h>
 
 // for mkdir:
 
@@ -138,7 +139,10 @@
     }
     else
     {
-        return false;
+        // If we can't open because the file is a directory, the 
+        // "file" exists at least!
+
+        return errno == EISDIR;
     }
 }