[Emul/Profile] Add PID info. to profile data path
[platform/adaptation/npu/trix-engine.git] / src / core / utils / ne-utils.cc
index e3cb659..8bf5990 100644 (file)
@@ -140,3 +140,15 @@ Logger::logwrite_args (npu_loglevel l, const char *tag, const char *format, va_l
 
   return 0;
 }
+
+bool
+createDirectory (const std::string &dir) {
+  /* FIXME: use std::filesystem when c++17 is used */
+  std::string command = "mkdir -p " + dir;
+  int ret = system (command.c_str ());
+
+  if (ret != 127 && ret != -1)
+    ret = WEXITSTATUS (ret);
+
+  return ret == 0;
+}