]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfilesel.c
Support added for building using a GNU toolchain on Win32,
[~andy/gtk] / gtk / gtkfilesel.c
index 16091ceb546ab94408a410094f227e8f50158802..5a654a072cb7557cc6e56a171508b4a098a5d610 100644 (file)
 
 #include "config.h"
 
+#include <glib.h>              /* To get stat->_stat redefinition
+                                *  for mingw32
+                                */
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <pwd.h>
 #endif
 
-#ifdef WIN32
-#define STRICT
-#include <windows.h>
-
-#ifdef _MSC_VER
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode)&_S_IFDIR)
-#endif
-#define mkdir(path,mode) mkdir(path)
-#endif
-#endif
-
 #include "fnmatch.h"
 
 #include "gdk/gdkkeysyms.h"
 #include "gtkdialog.h"
 #include "gtkintl.h"
 
+#ifdef WIN32
+#define STRICT
+#include <windows.h>
+
+#ifdef NATIVE_WIN32
+#include <direct.h>
+#include <io.h>
+#define mkdir(p,m) _mkdir(p)
+#ifndef S_ISDIR
+#define S_ISDIR(mode) ((mode)&_S_IFDIR)
+#endif
+
+#endif /* NATIVE_WIN32 */
+
+#endif /* WIN32 */
+
 #define DIR_LIST_WIDTH   180
 #define DIR_LIST_HEIGHT  180
 #define FILE_LIST_WIDTH  180
@@ -2797,7 +2805,12 @@ attempt_file_completion(CompletionState *cmpl_state)
 
       pat_buf = g_new (gchar, len + 2);
       strcpy(pat_buf, dir->cmpl_text);
-      strcpy(pat_buf + len, "*");
+      /* Don't append a * if the user entered one herself.
+       * This way one can complete *.h and don't get matches
+       * on any .help files, for instance.
+       */
+      if (strchr(pat_buf, '*') == NULL)
+       strcpy(pat_buf + len, "*");
     }
 
   if(first_slash)