Add post processor
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / builder-filesystem.h
old mode 100755 (executable)
new mode 100644 (file)
index 75e9d28..5e032a0
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 // EXTERNAL INCLUDES
-#include <string>
 #include <fstream>
 #include <sstream>
+#include <string>
 
-#include <wordexp.h>
 #include <stdio.h>
-#include <unistd.h>
 
-inline std::string ExpandPath(const std::string &name)
+#include <dali/devel-api/adaptor-framework/file-loader.h>
+
+inline std::string GetFileContents(const std::string& fn)
 {
-  wordexp_t p;
-  char** w;
-  wordexp( name.c_str(), &p, 0 );
-  w = p.we_wordv;
-  std::stringstream s;
-  for (size_t i=0; i<p.we_wordc;i++ )
+  std::streampos     bufferSize = 0;
+  Dali::Vector<char> fileBuffer;
+  if(!Dali::FileLoader::ReadFile(fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY))
   {
-    s << w[i];
+    return std::string();
   }
-  wordfree( &p );
-  return s.str();
-}
-
 
-inline std::string ExePath(void)
-{
-  char buf[256];
-  ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
-  len = len > 0 ? len : 0;
-  buf[len] = '\0';
-  return std::string(buf);
-}
-
-inline std::string GetFileContents(const std::string &fn)
-{
-  std::ifstream t(fn.c_str());
-  return std::string((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
+  return std::string(&fileBuffer[0], bufferSize);
 }
 
 #endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H