summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-05 21:05:30 -0400
committerDavid Robillard <d@drobilla.net>2022-07-14 11:59:36 -0400
commit62cad71a1a36aabc550362d8fa4a61752076f7c9 (patch)
tree8b91219fce488271f892415a80cbbeb074e79556
parent13dc6658b30b3e2641471f9b72c07746c7b09e77 (diff)
downloadlilv-62cad71a1a36aabc550362d8fa4a61752076f7c9.tar.gz
lilv-62cad71a1a36aabc550362d8fa4a61752076f7c9.tar.bz2
lilv-62cad71a1a36aabc550362d8fa4a61752076f7c9.zip
Fix lilv_is_directory() in MinGW
-rw-r--r--src/filesystem.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/filesystem.c b/src/filesystem.c
index 307bda6..2785cca 100644
--- a/src/filesystem.c
+++ b/src/filesystem.c
@@ -310,8 +310,15 @@ lilv_path_exists(const char* path)
bool
lilv_is_directory(const char* path)
{
+#if defined(_WIN32)
+ const DWORD attrs = GetFileAttributes(path);
+
+ return (attrs != INVALID_FILE_ATTRIBUTES) &&
+ (attrs & FILE_ATTRIBUTE_DIRECTORY);
+#else
struct stat st;
return !stat(path, &st) && S_ISDIR(st.st_mode);
+#endif
}
int