OSDN Git Service

2007-04-20 Arnaud Charlet <charlet@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / mkdir.c
index 1aadf10..624a62c 100644 (file)
@@ -6,7 +6,7 @@
  *                                                                          *
  *                          C Implementation File                           *
  *                                                                          *
- *             Copyright (C) 2002-2006, Free Software Foundation, Inc.      *
+ *             Copyright (C) 2002-2007, Free Software Foundation, Inc.      *
  *                                                                          *
  * GNAT is free software;  you can  redistribute it  and/or modify it under *
  * terms of the  GNU General Public License as published  by the Free Soft- *
 #include "system.h"
 #endif
 
+#ifdef __MINGW32__
+#include "mingw32.h"
+#include <windows.h>
+#ifdef MAXPATHLEN
+#define GNAT_MAX_PATH_LEN MAXPATHLEN
+#else
+#define GNAT_MAX_PATH_LEN 256
+#endif
+#endif
+
 #include "adaint.h"
 
 /*  This function provides a portable binding to the mkdir function.  */
 int
 __gnat_mkdir (char *dir_name)
 {
-#if defined (_WIN32) || (defined (__vxworks) \
-                         && !(defined (__RTP__) && (_WRS_VXWORKS_MINOR != 0)))
+#if defined (__vxworks) && !(defined (__RTP__) && (_WRS_VXWORKS_MINOR != 0))
   return mkdir (dir_name);
+#elif defined (__MINGW32__)
+  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+  S2WSU (wname, dir_name, GNAT_MAX_PATH_LEN + 2);
+  return _tmkdir (wname);
 #else
   return mkdir (dir_name, S_IRWXU | S_IRWXG | S_IRWXO);
 #endif