[msvc] Update csproj files
[mono.git] / eglib / src / gfile-win32.c
index a2e41ea9f6899db0036c8730f7258c85cacc262b..61e23cbe442856e8cabea65ed09ac4e6ec3d3c3c 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#include <direct.h>
 
 #ifdef G_OS_WIN32
 #include <io.h>
@@ -58,7 +59,7 @@ int mkstemp (char *tmp_template)
        utf16_template = _wmktemp( utf16_template);
        if (utf16_template && *utf16_template) {
                /* FIXME: _O_TEMPORARY causes file to disappear on close causing a test to fail */
-               fd = _wopen( utf16_template, _O_BINARY | _O_CREAT /*| _O_TEMPORARY*/ | _O_EXCL, _S_IREAD | _S_IWRITE);
+               fd = _wopen( utf16_template, _O_BINARY | _O_CREAT /*| _O_TEMPORARY*/ | _O_RDWR | _O_EXCL, _S_IREAD | _S_IWRITE);
        }
 
        /* FIXME: this will crash if utf16_template == NULL */
@@ -68,6 +69,26 @@ int mkstemp (char *tmp_template)
        return fd;
 }
 
+gchar *
+g_mkdtemp (char *tmp_template)
+{
+       gunichar2* utf16_template;
+
+       utf16_template  = u8to16 (tmp_template);
+
+       utf16_template = _wmktemp(utf16_template);
+       if (utf16_template && *utf16_template) {
+               if (_wmkdir (utf16_template) == 0){
+                       char *ret = u16to8 (utf16_template);
+                       g_free (utf16_template);
+                       return ret;
+               }
+       }
+
+       g_free (utf16_template);
+       return NULL;
+}
+            
 #ifdef _MSC_VER
 #pragma warning(disable:4701)
 #endif