From b656b13cc6f1d021ec4978dd048387edd6806e1d Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 11 Jul 2022 16:28:46 +0200 Subject: [PATCH] More portable directory macros --- src/templates_text/templator_text.org | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/templates_text/templator_text.org b/src/templates_text/templator_text.org index 88908e7..b54f0c1 100644 --- a/src/templates_text/templator_text.org +++ b/src/templates_text/templator_text.org @@ -143,7 +143,15 @@ trexio_text_inquire (const char* file_name) if (file_exists) { - bool is_a_directory = st.st_mode & S_IFDIR; + bool is_a_directory = false; +#ifdef S_IFDIR + is_a_directory = st.st_mode & S_IFDIR; +#elif S_ISDIR + is_a_directory = S_ISDIR(s.st_mode); +#else + printf("Some important macros are missing for directory handling.\n"); + return TREXIO_FAILURE; +#endif if (!is_a_directory) return TREXIO_FILE_ERROR; return TREXIO_SUCCESS;