MSVC: compat: implement realpath()
diff --git a/compat/compat.c b/compat/compat.c
index d75b961..d721616 100644
--- a/compat/compat.c
+++ b/compat/compat.c
@@ -250,3 +250,21 @@
}
#endif
+
+#ifndef HAVE_REALPATH
+#ifdef _WIN32
+char *
+realpath(const char *path, char *resolved_path)
+{
+ char *resolved = _fullpath(resolved_path, path, PATH_MAX);
+
+ if ((_access(resolved, 0) == -1) && (errno == ENOENT)) {
+ return NULL;
+ }
+ return resolved;
+}
+
+#else
+#error No realpath() implementation for this platform is available.
+#endif
+#endif