Add realpath() for Win32

This commit is contained in:
Sergey Lyubka committed 2021-12-22 18:04:36 +00:00
1 parent af3a0f6af0
commit 92d3c7a4cd
2 files changed
+9 -2

No files matched your search

+6 -1
View File
@@ -517,7 +517,11 @@ struct mg_fs mg_fs_packed = {packed_stat, packed_list, packed_open,
#if MG_ENABLE_FILE
static int p_stat(const char *path, size_t *size, time_t *mtime) {
#ifdef _WIN32
#if !defined(S_ISDIR)
LOG(LL_ERROR, ("stat() API is not supported. %p %p %p", path, size, mtime));
return 0;
#else
#if defined(_WIN32)
struct _stati64 st;
wchar_t tmp[PATH_MAX];
MultiByteToWideChar(CP_UTF8, 0, path, -1, tmp, sizeof(tmp) / sizeof(tmp[0]));
@@ -529,6 +533,7 @@ static int p_stat(const char *path, size_t *size, time_t *mtime) {
if (size) *size = (size_t) st.st_size;
if (mtime) *mtime = st.st_mtime;
return MG_FS_READ | MG_FS_WRITE | (S_ISDIR(st.st_mode) ? MG_FS_DIR : 0);
#endif
}
#ifdef _WIN32