Skip to content

Commit

Permalink
fixed mkdir warning on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuomingliang committed Oct 18, 2016
1 parent 404ed26 commit 360ddcd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/io/dirops.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 360ddcd

Please sign in to comment.