reinvented the wheel on linux
#include <string>
#include <sys/statfs.h>
bool existsDir( const std::string& dir ) {
    return existsFile( dir );
}
bool existsFile( const std::string& file ) {
    struct stat fileInfo;
    int error = stat( file.c_str(), &fileInfo );
    if( error == 0 ){
        return true;
    } else {
        return false;
    }
}
bool createDir( std::string dir, int mask = S_IRWXU | S_IRWXG | S_IRWXO ) {
    if( !existsDir( dir ) ) {
        mkdir( dir.c_str(), mask );
        return existsDir( dir );
    } else {
        return true;
    }
}
bool createPath( std::string path, int mask = S_IRWXU | S_IRWXG | S_IRWXO ) {
    if( path.at( path.length()-1 ) == '/' ){
        path.erase( path.length()-1 );
    }
    std::list<std::string> pathParts;
    int slashPos = 0;
    while( true ) {
        slashPos = path.find_first_of( "/", slashPos+1 );
        if( slashPos < 0)
            break;
        std::string pp( path.substr( 0, slashPos ) );
        pathParts.push_back( pp );
    }
    std::list<std::string>::const_iterator pp_cit;
    for( pp_cit=pathParts.begin(); pp_cit!=pathParts.end(); ++pp_cit ){
        createDir( (*pp_cit), mask );
    }
    createDir( path, mask );
    return existsDir( path );
}