Add error message when the file load fails 85/249385/2
authorhuiyu.eun <huiyu.eun@samsung.com>
Fri, 11 Dec 2020 05:21:01 +0000 (14:21 +0900)
committerhuiyu eun <huiyu.eun@samsung.com>
Mon, 14 Dec 2020 04:39:22 +0000 (04:39 +0000)
Change-Id: I046ac03a559bea2b8d856d54951d252f46be8cf9
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
dali/internal/adaptor-framework/generic/file-loader-impl-generic.cpp
dali/internal/adaptor-framework/generic/file-stream-impl-generic.cpp

index f81d01f..0baa2bf 100644 (file)
@@ -18,7 +18,7 @@
 #include <dali/internal/adaptor-framework/common/file-loader-impl.h>
 
 // EXTERNAL INCLUDES
-#include <string>
+#include <cstring>
 #include <fstream>
 
 #include <dali/integration-api/debug.h>
@@ -81,7 +81,8 @@ int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector
   }
   else
   {
-    DALI_LOG_ERROR( "file open failed for: \"%s\"\n", filename.c_str() );
+    char buf[512];
+    DALI_LOG_ERROR( "file open failed for: \"%s\", error : %s\n", filename.c_str(), strerror_r( errno, buf, 512 )  );
   }
 
   return errorCode;
index 3f40285..98bdb96 100644 (file)
@@ -18,7 +18,7 @@
 #include <dali/internal/adaptor-framework/common/file-stream-impl.h>
 
 // EXTERNAL INCLUDES
-#include <string>
+#include <cstring>
 #include <fstream>
 
 #include <dali/integration-api/debug.h>
@@ -190,7 +190,9 @@ FILE* FileStream::Impl::GetFile()
     mFile = fopen( mFileName.c_str(), openMode );
     if( !mFile )
     {
+      char buf[512];
       DALI_LOG_ERROR( "file open failed for: \"%s\", in mode: \"%s\".\n", mFileName.c_str(), openMode );
+      DALI_LOG_ERROR( "file open failed error : %s\n", strerror_r( errno, buf, 512 )  );
     }
   }
   else if( mBuffer )
@@ -198,8 +200,10 @@ FILE* FileStream::Impl::GetFile()
     mFile = fmemopen( mBuffer, mDataSize, openMode );
     if( !mFile )
     {
+      char buf[512];
       DALI_LOG_ERROR( "File open failed for memory buffer at location: \"%p\", of size: \"%u\", in mode: \"%s\".\n",
           static_cast<void*>( mBuffer ), static_cast<unsigned>( mDataSize ), openMode );
+      DALI_LOG_ERROR( "file open failed error : %s\n",  strerror_r( errno, buf, 512 )  );
     }
   }