From 360ddcdd0df5948279d1e31d52dada59ea73b2be Mon Sep 17 00:00:00 2001 From: Jimmy Zhuo Date: Wed, 19 Oct 2016 02:39:44 +0800 Subject: [PATCH] fixed mkdir warning on windows --- src/io/dirops.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/io/dirops.c b/src/io/dirops.c index 01dea617b7..eb29ea62fe 100644 --- a/src/io/dirops.c +++ b/src/io/dirops.c @@ -31,24 +31,25 @@ static char * UnicodeToUTF8(const wchar_t *str) } static int mkdir_p(MVMThreadContext *tc, wchar_t *pathname, MVMint64 mode) { + wchar_t *p = pathname, ch; #else static int mkdir_p(MVMThreadContext *tc, char *pathname, MVMint64 mode) { -#endif - int created = 0; char *p = pathname, ch; - struct stat st; uv_fs_t req; +#endif + int created = 0; for (;; ++p) if (!*p || IS_SLASH(*p)) { ch = *p; *p = '\0'; - if (uv_fs_stat(tc->loop, &req, pathname, NULL) <= 0) { #ifdef _WIN32 + if (!PathFileExistsW(pathname)) { if (CreateDirectoryW(pathname, NULL)) { created = 1; } #else + if (uv_fs_stat(tc->loop, &req, pathname, NULL) <= 0) { if (mkdir(pathname, mode) != -1) { created = 1; }