cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: create-dirs on win32

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 8 Jan 2003 11:52:28 +0100 (MET)

On Tue, 7 Jan 2003, matthew b wrote:

> So my current version is as follows; I don't have time to do any more with
> this, or check if errno is set, but it makes things quite a bit cleaner
>
> 1) after the malloc, still set dirbuild[0] = '\0'; otherwise leave
> create_dir_hierarchy alone.

I already committed this fix separately, it was an OS-agnostic error.

> 2) somewhere (I stuck it in the #ifdef WIN32 at the top of the file, you
> may want to put it elsewhere, and only for VC6), add the following:
>
> #ifdef whatever-the-right-thing-is
> #include <direct.h>
> #define F_OK 0
> // you might want to split this into declaration/definition, i just threw it
> in main.c and thus didn't care.
> // you might to use better name than mkdirWIN32hack. maybe mkdirNoMode
> int mkdirWIN32hack(const char * sz, int mode)
> {
> return mkdir(sz);
> }
> #define mkdir mkdirWIN32hack
> #define mode_t int
> #endif

How about using this even simpler approach?

diff -u -r1.158 main.c
--- main.c 7 Jan 2003 09:35:57 -0000 1.158
+++ main.c 8 Jan 2003 10:51:04 -0000
@@ -145,6 +145,12 @@
 }
 #endif

+#ifdef WIN32
+#include <direct.h>
+#define F_OK 0
+#define mkdir(x,y) (mkdir)(x)
+#endif
+
 #ifdef VMS
 int vms_show = 0;
 #define FAC_CURL 0xC01

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
Received on 2003-01-08