Commit b3283560 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[CHANGE] I think its better to rely on boost filesystem then the ordinary find method.

parent 2e57dfb6
......@@ -30,7 +30,7 @@ ENDIF( CMAKE_BUILD_TYPE STREQUAL "Static" )
# To see which boost libs we currently use, you may run the following command
# in the trunk/src directory on a linux box to make some investigations:
# grep -i include `find . -type f` | grep boost | awk '{print $2}' | sort | uniq
FIND_PACKAGE( Boost REQUIRED program_options thread )
FIND_PACKAGE( Boost REQUIRED program_options thread filesystem )
ASSERT_GE_VERSION( "Boost" "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" 1.36.0 )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
......
......@@ -24,6 +24,7 @@
#include <iostream>
#include <string>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include "WLoaderManager.h"
#include "WDataSet.h"
......@@ -33,33 +34,30 @@
std::string getSuffix( std::string name )
{
size_t position = name.find_last_of( '.' );
if( position == std::string::npos )
return "";
else
return name.substr( position + 1 );
boost::filesystem::path p( name );
return p.extension();
}
void WLoaderManager::load( std::string fileName, boost::shared_ptr< WDataHandler > dataHandler )
{
std::string suffix = getSuffix( fileName );
if( suffix == "nii" || suffix == "gz" )
if( suffix == ".nii" || suffix == ".gz" )
{
WLoaderNIfTI niiLoader( fileName, dataHandler );
boost::thread loaderThread( niiLoader );
}
else if( suffix == "edf" )
else if( suffix == ".edf" )
{
WLoaderBiosig biosigLoader( fileName, dataHandler );
boost::thread loaderThread( biosigLoader );
}
else if( suffix == "asc" )
else if( suffix == ".asc" )
{
WLoaderEEGASCII eegAsciiLoader( fileName, dataHandler );
boost::thread loaderThread( eegAsciiLoader );
}
else if( suffix == "vtk" )
else if( suffix == ".vtk" )
{
// This is a dummy implementation.
// You need to provide a real implementation here if you want to load vtk.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment