[dali_1.4.28] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / builder-filesystem.h
index d7118dd..947f8ce 100755 (executable)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__
-#define __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__
+#ifndef DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
+#define DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -27,6 +27,8 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include <dali/devel-api/adaptor-framework/file-loader.h>
+
 inline std::string ExpandPath(const std::string &name)
 {
   wordexp_t p;
@@ -54,8 +56,14 @@ inline std::string ExePath(void)
 
 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>());
+  std::streampos bufferSize = 0;
+  Dali::Vector<char> fileBuffer;
+  if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY ) )
+  {
+      return std::string();
+  }
+
+  return std::string( &fileBuffer[0], bufferSize );
 }
 
-#endif // __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__
+#endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H