Commit e8991c64 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[FIX #129] switched completely to filesystem 3.

parent ca5a285d
......@@ -26,10 +26,6 @@
#include <streambuf>
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include "exceptions/WFileNotFound.h"
......@@ -43,11 +39,11 @@ std::string readFileIntoString( const std::string& name )
std::string readFileIntoString( const boost::filesystem::path& path )
{
std::string filename = path.file_string();
std::string filename = path.string();
std::ifstream input( filename.c_str() );
if( !input.is_open() )
{
throw WFileNotFound( std::string( "The file \"" ) + boost::filesystem::complete( path ).file_string() + std::string( "\" does not exist." ) );
throw WFileNotFound( std::string( "The file \"" ) + path.string() + std::string( "\" does not exist." ) );
}
// preallocate space for the string.
......@@ -69,10 +65,10 @@ void writeStringIntoFile( const std::string& name, const std::string& content )
void writeStringIntoFile( const boost::filesystem::path& path, const std::string& content )
{
std::ofstream outfile( path.file_string().c_str() );
std::ofstream outfile( path.string().c_str() );
if( !outfile.is_open() )
{
throw WFileOpenFailed( "The file \"" + boost::filesystem::complete( path ).file_string() + "\" could not be opened." );
throw WFileOpenFailed( "The file \"" + path.string() + "\" could not be opened." );
}
outfile << content << std::flush;
......
......@@ -30,10 +30,6 @@
#include <algorithm>
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include "WExportCommon.h"
......@@ -92,13 +88,22 @@ template< class T > void switchByteOrderOfArray( T *array, const size_t arraySiz
}
}
/**
* \param name File name to get the extension or suffix from.
* \return filename suffix
*/
inline std::string getSuffix( boost::filesystem::path name )
{
return name.extension().string();
}
/**
* \param name File name to get the extension or suffix from.
* \return filename suffix
*/
inline std::string getSuffix( std::string name )
{
return boost::filesystem::path( name ).extension();
return getSuffix( boost::filesystem::path( name ) );
}
/**
......
......@@ -27,10 +27,6 @@
#include <vector>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -25,10 +25,6 @@
#include <list>
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include "exceptions/WPropertyNameMalformed.h"
......
......@@ -32,10 +32,6 @@
#include <vector>
#include <utility>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
......
......@@ -31,10 +31,6 @@
#include <windows.h> // NOLINT
#endif
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include "exceptions/WLibraryFetchFailed.h"
......@@ -243,7 +239,7 @@ struct WSharedLib::data
#endif
WSharedLib::WSharedLib( boost::filesystem::path lib ):
m_data( new data( lib.native_file_string() ) )
m_data( new data( lib.string() ) )
{
}
......
......@@ -28,10 +28,6 @@
#include <algorithm>
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include "WExportCommon.h"
......
......@@ -105,7 +105,7 @@ public:
boost::filesystem::path fpath = tempFileName();
writeStringIntoFile( fpath, content );
std::ifstream input( fpath.file_string().c_str() );
std::ifstream input( fpath.string().c_str() );
std::string actual;
actual.assign( ( std::istreambuf_iterator< char >( input ) ), std::istreambuf_iterator< char >() );
input.close();
......
......@@ -28,10 +28,6 @@
#include <utility>
#include <vector>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
......
......@@ -24,10 +24,6 @@
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include "../../common/WIOTools.h"
......
......@@ -25,10 +25,6 @@
#include <fstream>
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
......@@ -39,7 +35,7 @@
#include "WWriterDendrogram.h"
WWriterDendrogram::WWriterDendrogram( const boost::filesystem::path& path, bool overwrite )
: WWriter( path.file_string(), overwrite )
: WWriter( path.string(), overwrite )
{
}
......
......@@ -27,10 +27,6 @@
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -25,10 +25,6 @@
#include <fstream>
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
......@@ -39,7 +35,7 @@
#include "WWriterFiberVTK.h"
WWriterFiberVTK::WWriterFiberVTK( const boost::filesystem::path& path, bool overwrite )
: WWriter( path.file_string(), overwrite )
: WWriter( path.string(), overwrite )
{
}
void WWriterFiberVTK::writeFibs( boost::shared_ptr< const WDataSetFibers > fiberDS ) const
......
......@@ -27,10 +27,6 @@
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -388,7 +388,7 @@ osg::ref_ptr< osg::PositionAttitudeTransform > wge::addLabel( osg::Vec3 position
labelGeode->addDrawable( label );
// setup font
label->setFont( WPathHelper::getAllFonts().Default.file_string() );
label->setFont( WPathHelper::getAllFonts().Default.string() );
label->setBackdropType( osgText::Text::OUTLINE );
label->setCharacterSize( 6 );
......
......@@ -261,7 +261,7 @@ WGETextureHud::WGETextureHudEntry::WGETextureHudEntry( osg::ref_ptr< osg::Textur
state->setMode( GL_DEPTH_TEST, osg::StateAttribute::OFF );
addChild( textGeode );
osgText::Text* label = new osgText::Text();
label->setFont( WPathHelper::getAllFonts().Default.file_string() );
label->setFont( WPathHelper::getAllFonts().Default.string() );
label->setBackdropType( osgText::Text::OUTLINE );
label->setCharacterSize( 15 );
label->setText( m_name );
......
......@@ -29,10 +29,6 @@
#include <fstream>
#include <boost/algorithm/string.hpp>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/function.hpp>
#include <boost/lexical_cast.hpp>
......@@ -242,9 +238,9 @@ std::string WGEShader::processShaderRecursive( const std::string filename, bool
// use one of the following paths
std::string fn = filename;
std::string fnLocal = ( m_shaderPath / filename ).file_string();
std::string fnLocalShaders = ( m_shaderPath / "shaders" / filename ).file_string();
std::string fnGlobal = ( WPathHelper::getShaderPath() / filename ).file_string();
std::string fnLocal = ( m_shaderPath / filename ).string();
std::string fnLocalShaders = ( m_shaderPath / "shaders" / filename ).string();
std::string fnGlobal = ( WPathHelper::getShaderPath() / filename ).string();
if( boost::filesystem::exists( m_shaderPath / filename ) )
{
......@@ -261,8 +257,8 @@ std::string WGEShader::processShaderRecursive( const std::string filename, bool
else if( !optional )
{
WLogger::getLogger()->addLogMessage( "The requested shader \"" + filename + "\" does not exist in \"" +
m_shaderPath.file_string() + "\", \"" + ( m_shaderPath / "shaders" ).file_string() + "\" or \"" +
WPathHelper::getShaderPath().file_string() + "\".", "WGEShader (" + filename + ")", LL_ERROR
m_shaderPath.string() + "\", \"" + ( m_shaderPath / "shaders" ).string() + "\" or \"" +
WPathHelper::getShaderPath().string() + "\".", "WGEShader (" + filename + ")", LL_ERROR
);
return "";
......
......@@ -28,10 +28,6 @@
#include <map>
#include <string>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/signals2/signal.hpp>
......
......@@ -33,7 +33,7 @@ WGELabel::WGELabel():
{
// initialize members
setCharacterSize( 21 );
setFont( WPathHelper::getAllFonts().Default.file_string() );
setFont( WPathHelper::getAllFonts().Default.string() );
setAxisAlignment( osgText::Text::SCREEN );
setAlignment( osgText::Text::LEFT_BOTTOM );
setBackdropType( osgText::Text::OUTLINE );
......
......@@ -33,11 +33,6 @@
#include <string>
#include <vector>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include "../common/WThreadedRunner.h"
#include "../common/WTimer.h"
#include "../common/WRealtimeTimer.h"
......
......@@ -30,10 +30,6 @@
#include <vector>
#include <boost/enable_shared_from_this.hpp>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -54,8 +54,8 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
i != boost::filesystem::directory_iterator(); ++i )
{
// all modules need to begin with this
std::string suffix = getSuffix( i->leaf() );
std::string stem = i->path().stem();
std::string suffix = getSuffix( i->path() );
std::string stem = i->path().stem().string();
#ifdef _MSC_VER
std::string supposedFilename = getModulePrefix() + '_' + i->path().parent_path().filename()
......@@ -67,8 +67,8 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
#endif // _MSC_VER
// we want to strip the search directory from the path
std::string relPath = i->path().file_string();
relPath.erase( 0, dir.file_string().length() + 1 ); // NOTE: +1 because we want to remove the "/" too
std::string relPath = i->path().string();
relPath.erase( 0, dir.string().length() + 1 ); // NOTE: +1 because we want to remove the "/" too
// is it a lib? Use a regular expression to check this
// NOTE:: the double \\ is needed to escape the escape char
......@@ -145,12 +145,12 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
// go through each of the paths
for( std::vector< boost::filesystem::path >::const_iterator path = allPaths.begin(); path != allPaths.end(); ++path )
{
WLogger::getLogger()->addLogMessage( "Searching modules in \"" + ( *path ).file_string() + "\".", "Module Loader", LL_INFO );
WLogger::getLogger()->addLogMessage( "Searching modules in \"" + ( *path ).string() + "\".", "Module Loader", LL_INFO );
// does the directory exist?
if( !boost::filesystem::is_directory( *path ) || !boost::filesystem::exists( *path ) )
{
WLogger::getLogger()->addLogMessage( "Searching modules in \"" + ( *path ).file_string() +
WLogger::getLogger()->addLogMessage( "Searching modules in \"" + ( *path ).string() +
"\" failed. It is not a directory or does not exist." +
" Ignoring.", "Module Loader", LL_WARNING );
......
......@@ -29,10 +29,6 @@
#include <string>
#include <vector>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -86,13 +86,13 @@ void WProjectFile::load()
void WProjectFile::save( const std::vector< boost::shared_ptr< WProjectFileIO > >& writer )
{
wlog::info( "Project File" ) << "Saving project file \"" << m_project.file_string() << "\".";
wlog::info( "Project File" ) << "Saving project file \"" << m_project.string() << "\".";
// open the file for write
std::ofstream output( m_project.file_string().c_str() );
std::ofstream output( m_project.string().c_str() );
if( !output.is_open() )
{
throw WFileOpenFailed( std::string( "The project file \"" ) + m_project.file_string() +
throw WFileOpenFailed( std::string( "The project file \"" ) + m_project.string() +
std::string( "\" could not be opened for write access." ) );
}
......@@ -114,13 +114,13 @@ void WProjectFile::save()
void WProjectFile::threadMain()
{
// Parse the file
wlog::info( "Project File" ) << "Loading project file \"" << m_project.file_string() << "\".";
wlog::info( "Project File" ) << "Loading project file \"" << m_project.string() << "\".";
// read the file
std::ifstream input( m_project.file_string().c_str() );
std::ifstream input( m_project.string().c_str() );
if( !input.is_open() )
{
throw WFileNotFound( std::string( "The project file \"" ) + m_project.file_string() +
throw WFileNotFound( std::string( "The project file \"" ) + m_project.string() +
std::string( "\" does not exist." ) );
}
......
......@@ -28,10 +28,6 @@
#include <string>
#include <vector>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -25,10 +25,6 @@
#include <string>
#include <vector>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <osg/Image>
......@@ -136,7 +132,7 @@ bool WMAtlasCreator::loadPngs( boost::filesystem::path sliceFile )
}
osg::Image* osgImage;
osgImage = osgDB::readImageFile( sliceFile.file_string().c_str() );
osgImage = osgDB::readImageFile( sliceFile.string().c_str() );
debugLog() << osgImage->r() << " : " << osgImage->s() << " : " << osgImage->t();
......@@ -146,14 +142,14 @@ bool WMAtlasCreator::loadPngs( boost::filesystem::path sliceFile )
path dirPath( sliceFile );
dirPath.remove_filename().file_string();
dirPath.remove_filename().string();
m_volume.resize( m_xDim * m_yDim * m_zDim, 0 );
directory_iterator end_itr; // default construction yields past-the-end
for( directory_iterator itr( dirPath ); itr != end_itr; ++itr )
{
//debugLog() << itr->path().file_string().c_str();
//debugLog() << itr->path().string().c_str();
path p( itr->path() );
if( p.extension() == ".png" )
......@@ -174,7 +170,7 @@ void WMAtlasCreator::addPngToVolume( boost::filesystem::path image )
{
using namespace boost::filesystem; //NOLINT
std::string fn = image.filename();
std::string fn = image.filename().string();
fn.erase( fn.size() - 4, 4 );
std::string number = fn.substr( fn.size() - 3 );
fn.erase( fn.size() - 3, 3 );
......@@ -204,7 +200,7 @@ void WMAtlasCreator::addPngToVolume( boost::filesystem::path image )
}
osg::Image* osgImage;
osgImage = osgDB::readImageFile( image.file_string().c_str() );
osgImage = osgDB::readImageFile( image.string().c_str() );
unsigned char* data = osgImage->data();
pos /= 2;
......
......@@ -405,7 +405,7 @@ void WMClusterDisplay::moduleMain()
if( m_readTriggerProp->get( true ) == WPVBaseTypes::PV_TRIGGER_TRIGGERED )
{
std::string fileName = m_propTreeFile->get().file_string().c_str();
std::string fileName = m_propTreeFile->get().string().c_str();
treeLoaded = loadTreeAscii( fileName );
m_readTriggerProp->set( WPVBaseTypes::PV_TRIGGER_READY, true );
if( treeLoaded )
......
......@@ -26,10 +26,6 @@
#include <string>
#include <vector>
// Use filesystem version 2 for compatibility with newer boost versions.
#ifndef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
......
......@@ -106,7 +106,7 @@ void WRulerOrtho::addLabel( osg::Vec3 position, std::string text )
labelGeode->addDrawable( label );
// setup font
label->setFont( WPathHelper::getAllFonts().Default.file_string() );
label->setFont( WPathHelper::getAllFonts().Default.string() );
label->setBackdropType( osgText::Text::OUTLINE );
label->setCharacterSize( 6 );
......
......@@ -167,7 +167,7 @@ void WMWriteNIfTI::writeToFile()
{
m_saveTriggerProp->set( WPVBaseTypes::PV_TRIGGER_READY, false );
infoLog() << "Writing Data to " << m_filename->get().file_string();
infoLog() << "Writing Data to " << m_filename->get().string();
nifti_image *outField = nifti_simple_init_nim();
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_dataSet->getGrid() );
......@@ -281,7 +281,7 @@ void WMWriteNIfTI::writeToFile()
}
outField->data = data;
std::string s = m_filename->get().file_string();
std::string s = m_filename->get().string();
if( nifti_set_filenames( outField, s.c_str(), 0, 1 ) )
{
throw WException( std::string( "NIfTI filename Problem" ) );
......
......@@ -140,7 +140,7 @@ boost::shared_ptr< WDataSetFibers > WMFiberTranslator::mergeFibers( boost::files
if( !boost::filesystem::exists( dir ) || !boost::filesystem::is_directory( dir ) )
{
errorLog() << "Directory " << dir.file_string() << " does not exist!";
errorLog() << "Directory " << dir.string() << " does not exist!";
return boost::shared_ptr< WDataSetFibers >();
}
......@@ -158,7 +158,7 @@ boost::shared_ptr< WDataSetFibers > WMFiberTranslator::mergeFibers( boost::files
continue;
}
std::fstream f( it->path().file_string().c_str(), std::ios::in );
std::fstream f( it->path().string().c_str(), std::ios::in );
WVector3d v;
while( f >> v[ 0 ] >> v[ 1 ] >> v[ 2 ] )
......@@ -184,7 +184,7 @@ boost::shared_ptr< WDataSetFibers > WMFiberTranslator::mergeFibersNrrd( boost::f
if( !boost::filesystem::exists( dir ) || !boost::filesystem::is_directory( dir ) )
{
errorLog() << "Directory " << dir.file_string() << " does not exist!";
errorLog() << "Directory " << dir.string() << " does not exist!";
return boost::shared_ptr< WDataSetFibers >();
}
......@@ -202,7 +202,7 @@ boost::shared_ptr< WDataSetFibers > WMFiberTranslator::mergeFibersNrrd( boost::f
continue;
}
std::fstream f( it->path().file_string().c_str(), std::ios::in | std::ios::binary );
std::fstream f( it->path().string().c_str(), std::ios::in | std::ios::binary );
WVector3d v;
while( f >> v[ 0 ] >> v[ 1 ] >> v[ 2 ] )
......@@ -230,26 +230,26 @@ boost::shared_ptr< WDataSetFibers > WMFiberTranslator::loadExploreDTIFibers( boo
if( !boost::filesystem::exists( file ) || boost::filesystem::is_directory( file ) )
{
errorLog() << "File " << file.file_string() << " does not exist!";
errorLog() << "File " << file.string() << " does not exist!";
return boost::shared_ptr< WDataSetFibers >();
}
// the file should end in "_coordinates.txt"
if( file.file_string().length() < 16 || file.file_string().find( "_coordinates.txt" ) != file.file_string().length() - 16 )
if( file.string().length() < 16 || file.string().find( "_coordinates.txt" ) != file.string().length() - 16 )
{
errorLog() << "File " << file << " does not end in _coordinates.txt. Ignoring.";
return boost::shared_ptr< WDataSetFibers >();
}
// get the name of the corresponding fiber length file
std::string lengthFile = file.file_string();
std::string lengthFile = file.string();
lengthFile.resize( lengthFile.length() - 16 );
lengthFile += "_lengths.txt";
WFiberAccumulator accu;
// open files
std::fstream coords( file.file_string().c_str(), std::ios::in );
std::fstream coords( file.string().c_str(), std::ios::in );
std::fstream lengths( lengthFile.c_str(), std::ios::in );
while( !lengths.eof() && !lengths.bad() )
......
......@@ -1061,7 +1061,7 @@ void WMHistogramView::createFrame()
osgText::Text* text = new osgText::Text;
WVector2d textPos = histogramSpaceToWindowSpace( WVector2d( i, 0.0 ) ) - offsetY * 1.2;
text->setFont( WPathHelper::getAllFonts().Default.file_string() );
text->setFont( WPathHelper::getAllFonts().Default.string() );
text->setColor( frameColor );
text->setCharacterSize( 12 );
text->setAlignment( osgText::TextBase::CENTER_TOP );
......@@ -1083,7 +1083,7 @@ void WMHistogramView::createFrame()
osgText::Text* text = new osgText::Text;
WVector2d textPos = histogramSpaceToWindowSpace( WVector2d( m_frameLowerLeft[ 0 ], i ) ) - offsetX * 1.2;
text->setFont( WPathHelper::getAllFonts().Default.file_string() );
text->setFont( WPathHelper::getAllFonts().Default.string() );
text->setColor( frameColor );
text->setCharacterSize( 12 );
text->setAlignment( osgText::TextBase::RIGHT_CENTER );
......@@ -1166,7 +1166,7 @@ void WMHistogramView::createInfo()
osgText::Text* text = new osgText::Text;