]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - fs.c
Merge branch 'cooking' of github.com:graphitemaster/gmqcc into cooking
[xonotic/gmqcc.git] / fs.c
diff --git a/fs.c b/fs.c
index eb1a57209d97bbd05b4c90bc75338ca2ae670f9f..8d73b1d0b8ae793aa8dfefad075c9013457298ec 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -232,7 +232,7 @@ int fs_file_getline(char **lineptr, size_t *n, FILE *stream) {
  * Now we implement some directory functionality.  Windows lacks dirent.h
  * this is such a pisss off, we implement it here.
  */  
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__)
     DIR *fs_dir_open(const char *name) {
         DIR *dir = (DIR*)mem_a(sizeof(DIR) + strlen(name));
         if (!dir)
@@ -301,26 +301,33 @@ int fs_file_getline(char **lineptr, size_t *n, FILE *stream) {
 #   undef  S_ISDIR
 #   define S_ISDIR(X) ((X)&_S_IFDIR)
 #else
-    #include <sys/stat.h> /* mkdir */
-    #include <unistd.h>   /* chdir */
+#   if !defined(__MINGW32__)
+#       include <sys/stat.h> /* mkdir */
+#       include <unistd.h>   /* chdir */
 
-    DIR *fs_dir_open(const char *name) {
-        return opendir(name);
-    }
+        int fs_dir_make(const char *path) {
+            return mkdir(path, 0700);
+        }
+#   else
+        int fs_dir_make(const char *path) {
+            return mkdir(path);
+        }
+#   endif /*! !defined(__MINGW32__) */
 
-    int fs_dir_close(DIR *dir) {
-        return closedir(dir);
-    }
+DIR *fs_dir_open(const char *name) {
+    return opendir(name);
+}
 
-    struct dirent *fs_dir_read(DIR *dir) {
-        return readdir(dir);
-    }
+int fs_dir_close(DIR *dir) {
+    return closedir(dir);
+}
 
-    int fs_dir_change(const char *path) {
-        return chdir(path);
-    }
+struct dirent *fs_dir_read(DIR *dir) {
+    return readdir(dir);
+}
 
-    int fs_dir_make(const char *path) {
-        return mkdir(path, 0700);
-    }
-#endif /*! defined (_WIN32) */
+int fs_dir_change(const char *path) {
+    return chdir(path);
+}
+
+#endif /*! defined(_WIN32) && !defined(__MINGW32__) */