aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2021-07-16 15:14:22 +0100
committerLKedward <laurence.kedward@bristol.ac.uk>2021-07-16 15:17:05 +0100
commit53027990c205eb905ff534544f4752ea92e747d7 (patch)
treeb50e4adc03ad78ca308dd55a0af0114a661b30ed
parent619d619bf5754437401c314521fd48ecd557a5a0 (diff)
downloadfpm-53027990c205eb905ff534544f4752ea92e747d7.tar.gz
fpm-53027990c205eb905ff534544f4752ea92e747d7.zip
Fix: dirent symbols for OSX.
-rw-r--r--src/c.c27
-rw-r--r--src/fpm_filesystem.F904
2 files changed, 29 insertions, 2 deletions
diff --git a/src/c.c b/src/c.c
index d9048a9..7075f42 100644
--- a/src/c.c
+++ b/src/c.c
@@ -1,6 +1,11 @@
#include <sys/stat.h>
#include <dirent.h>
+#ifdef __APPLE__
+DIR * opendir$INODE64( const char * dirName );
+struct dirent * readdir$INODE64( DIR * dir );
+#endif
+
int c_is_dir(const char *path)
{
struct stat m;
@@ -12,3 +17,25 @@ const char *get_d_name(struct dirent *d)
{
return (const char *) d->d_name;
}
+
+
+
+DIR *c_opendir(const char *dirname){
+
+#ifdef __APPLE__
+ return opendir$INODE64(dirname);
+#else
+ return opendir(dirname);
+#endif
+
+}
+
+struct dirent *c_readdir(DIR *dirp){
+
+#ifdef __APPLE__
+ return readdir$INODE64(dirp);
+#else
+ return readdir(dirp);
+#endif
+
+} \ No newline at end of file
diff --git a/src/fpm_filesystem.F90 b/src/fpm_filesystem.F90
index 9ae95cc..2851bfd 100644
--- a/src/fpm_filesystem.F90
+++ b/src/fpm_filesystem.F90
@@ -19,13 +19,13 @@ use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, stdout=>output_unit,
#ifndef FPM_BOOTSTRAP
interface
- function c_opendir(dir) result(r) bind(c, name="opendir")
+ function c_opendir(dir) result(r) bind(c, name="c_opendir")
import c_char, c_ptr
character(kind=c_char), intent(in) :: dir(*)
type(c_ptr) :: r
end function c_opendir
- function c_readdir(dir) result(r) bind(c, name="readdir")
+ function c_readdir(dir) result(r) bind(c, name="c_readdir")
import c_ptr
type(c_ptr), intent(in), value :: dir
type(c_ptr) :: r