aboutsummaryrefslogtreecommitdiff
path: root/src/filesystem_utilities.c
diff options
context:
space:
mode:
authorCarlos Une <brocolis@eml.cc>2021-07-16 21:15:47 -0300
committerCarlos Une <brocolis@eml.cc>2021-07-16 21:15:47 -0300
commite18017d155c7edb31a503203187c5d0bab20b846 (patch)
treec3ad7487f08b8a73793c5c81c8b67b5129bfcddb /src/filesystem_utilities.c
parentf884bfd38a546dba12ccabcce8581e7bab29e51f (diff)
downloadfpm-e18017d155c7edb31a503203187c5d0bab20b846.tar.gz
fpm-e18017d155c7edb31a503203187c5d0bab20b846.zip
Rename src\c.c => src\filesystem_utilities.c
Diffstat (limited to 'src/filesystem_utilities.c')
-rw-r--r--src/filesystem_utilities.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/filesystem_utilities.c b/src/filesystem_utilities.c
new file mode 100644
index 0000000..7075f42
--- /dev/null
+++ b/src/filesystem_utilities.c
@@ -0,0 +1,41 @@
+#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;
+ int r = stat(path, &m);
+ return r == 0 && S_ISDIR(m.st_mode);
+}
+
+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