diff --git a/include/uv-win.h b/include/uv-win.h index b744d624..24b22b31 100644 --- a/include/uv-win.h +++ b/include/uv-win.h @@ -294,6 +294,7 @@ typedef struct uv__dirent_s { char d_name[1]; } uv__dirent_t; +#define HAVE_DIRENT_TYPES #define UV__DT_DIR UV_DIRENT_DIR #define UV__DT_FILE UV_DIRENT_FILE #define UV__DT_LINK UV_DIRENT_LINK diff --git a/test/test-fs.c b/test/test-fs.c index 2c392251..cc5dc744 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -436,7 +436,11 @@ static void scandir_cb(uv_fs_t* req) { while (UV_EOF != uv_fs_scandir_next(req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } scandir_cb_count++; ASSERT(req->path); @@ -875,7 +879,11 @@ TEST_IMPL(fs_async_dir) { ASSERT(scandir_req.ptr); while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } uv_fs_req_cleanup(&scandir_req); ASSERT(!scandir_req.ptr); @@ -1695,7 +1703,11 @@ TEST_IMPL(fs_symlink_dir) { ASSERT(scandir_req.ptr); while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } uv_fs_req_cleanup(&scandir_req); ASSERT(!scandir_req.ptr); @@ -1715,7 +1727,11 @@ TEST_IMPL(fs_symlink_dir) { ASSERT(scandir_req.ptr); while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } uv_fs_req_cleanup(&scandir_req); ASSERT(!scandir_req.ptr);