[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] [Patch] [1/3] is_directory()



Dieser Patch fügt eine is_directory()-Funktion hinzu, die im dir.h-Header landet.
Index: lib/stdlibc/directory.c
===================================================================
--- lib/stdlibc/directory.c	(Revision 608)
+++ lib/stdlibc/directory.c	(Arbeitskopie)
@@ -82,3 +82,13 @@
     return TRUE;
 }
 
+bool is_directory(const char* dirname)
+{
+    io_resource_t* dir = directory_open(dirname);
+    if (dir != NULL) {
+        directory_close(dir);
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
Index: include/dir.h
===================================================================
--- include/dir.h	(Revision 608)
+++ include/dir.h	(Arbeitskopie)
@@ -44,5 +44,6 @@
 io_direntry_t* directory_read(io_resource_t* io_res);
 int directory_seek(io_resource_t* io_res, long int offset, int origin);
 bool directory_create(const char* dirname);
+bool is_directory(const char* dirname);
 
 #endif