init: Adding support to import directories

Support added so init scripts can now import directories.

BUG: 22721249
Change-Id: I02b566bfb50ea84469f1ea0c6ad205435a1df286
TEST: Tested importing a folder on arm64 emulator
diff --git a/init/util.cpp b/init/util.cpp
index 7f29e94..f6131e3 100644
--- a/init/util.cpp
+++ b/init/util.cpp
@@ -465,3 +465,14 @@
         android::base::StringAppendF(&hex, "%02x", bytes[i]);
     return hex;
 }
+
+/*
+ * Returns true is pathname is a directory
+ */
+bool is_dir(const char* pathname) {
+    struct stat info;
+    if (stat(pathname, &info) == -1) {
+        return false;
+    }
+    return S_ISDIR(info.st_mode);
+}