#include "shared/view.h"
#include "shared/utility.h"
#include <stdio.h>
+#include <dali/integration-api/debug.h>
+#include <dali/devel-api/adaptor-framework/file-stream.h>
using namespace Dali;
using Dali::Toolkit::TextLabel;
{
std::string fullpath( path );
fullpath += filename;
- FILE* f = fopen( fullpath.c_str(), "rb" );
- if( !f )
+
+ Dali::FileStream fileStream( fullpath, Dali::FileStream::READ | Dali::FileStream::BINARY );
+ FILE* file = fileStream.GetFile();
+ if( !file )
{
return false;
}
- fseek( f, 0, SEEK_END );
- size_t size = ftell( f );
- fseek( f, 0, SEEK_SET );
- output.resize( size + 1 );
- std::fill( output.begin(), output.end(), 0 );
- ssize_t result = fread( output.data(), size, 1, f );
- fclose( f );
-
- return ( result >= 0 );
+
+ bool retValue = false;
+ if( !fseek( file, 0, SEEK_END ) )
+ {
+ long int size = ftell( file );
+
+ if( ( size != -1L ) &&
+ ( ! fseek( file, 0, SEEK_SET ) ) )
+ {
+ output.resize( size + 1 );
+ std::fill( output.begin(), output.end(), 0 );
+ ssize_t result = fread( output.data(), size, 1, file );
+
+ retValue = ( result >= 0 );
+ }
+ }
+
+ return retValue;
}
/**
std::string shaderFSH( shaderName );
shaderVSH += ".vsh";
shaderFSH += ".fsh";
- LoadShaderCode( DEMO_SHADER_DIR, shaderVSH.c_str(), bufV );
- LoadShaderCode( DEMO_SHADER_DIR, shaderFSH.c_str(), bufF );
- Shader shader = Shader::New( bufV.data(), bufF.data() );
+
+ Shader shader;
+ if( LoadShaderCode( DEMO_SHADER_DIR, shaderVSH.c_str(), bufV ) &&
+ LoadShaderCode( DEMO_SHADER_DIR, shaderFSH.c_str(), bufF ) )
+ {
+ shader = Shader::New( bufV.data(), bufF.data() );
+ }
return shader;
}
ToolBar mToolBar;
};
-void RunTest( Application& application )
-{
- RayMarchingExample test( application );
-
- application.MainLoop();
-}
-
-// Entry point for Linux & Tizen applications
-//
int DALI_EXPORT_API main( int argc, char **argv )
{
Application application = Application::New( &argc, &argv );
-
- RunTest( application );
-
+ RayMarchingExample test( application );
+ application.MainLoop();
return 0;
}