Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2011, 9:03:59 PM (14 years ago)
Author:
rgrieder
Message:

Resolved problems with different Boost filesystem versions.

Location:
code/branches/kicklib/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/src/OrxonoxConfig.h.in

    r8073 r8225  
    228228}
    229229
     230// Define Boost Filesystem version
     231#include <boost/version.hpp>
     232#ifndef BOOST_FILESYSTEM_VERSION
     233#  if (BOOST_VERSION < 104600)
     234#    define BOOST_FILESYSTEM_VERSION 2
     235#  else
     236#    define BOOST_FILESYSTEM_VERSION 3
     237#  endif
     238#endif
     239
    230240#endif /* _OrxonoxConfig_H__ */
  • code/branches/kicklib/src/libraries/core/CorePrereqs.h

    r8071 r8225  
    261261namespace boost
    262262{
    263 #if BOOST_VERSION < 104400
     263#if (BOOST_VERSION < 104400)
     264
    264265    namespace filesystem
    265266    {
     
    268269        typedef basic_path<std::string, path_traits> path;
    269270    }
    270 #elif BOOST_VERSION < 104600
     271
     272#elif (BOOST_VERSION < 104800)
     273
     274# if BOOST_FILESYSTEM_VERSION == 2
    271275    namespace filesystem2
    272276    {
     
    281285        using filesystem2::path;
    282286    }
    283 #else
     287# elif BOOST_FILESYSTEM_VERSION == 3
    284288    namespace filesystem3
    285289    {
     
    290294        using filesystem3::path;
    291295    }
     296# endif
     297
     298#elif
     299
     300    // TODO: Check this once boost 1.48 is released
     301    namespace filesystem
     302    {
     303        class path;
     304    }
     305
    292306#endif
     307
    293308    class thread;
    294309    class mutex;
  • code/branches/kicklib/src/libraries/core/GraphicsManager.cc

    r8129 r8225  
    6161#include "command/ConsoleCommand.h"
    6262
     63// Differentiate Boost Filesystem v2 and v3
     64#if (BOOST_FILESYSTEM_VERSION < 3)
     65#  define BF_NATIVE_STRING file_string
     66#else
     67#  define BF_NATIVE_STRING string
     68#endif
     69
    6370namespace orxonox
    6471{
     
    243250        // Use backslash paths on Windows! file_string() already does that though.
    244251        for (unsigned int i = 0; i < plugins.size(); ++i)
    245 #if BOOST_FILESYSTEM_VERSION < 3
    246             ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
    247 #else
    248             ogreRoot_->loadPlugin((folder / plugins[i]).string());
    249 #endif
     252            ogreRoot_->loadPlugin((folder / plugins[i]).BF_NATIVE_STRING());
    250253    }
    251254
  • code/branches/kicklib/src/libraries/core/PathConfig.cc

    r8089 r8225  
    3333#include <cstdio>
    3434#include <vector>
    35 #include <boost/version.hpp>
    3635#include <boost/filesystem.hpp>
    3736
     
    5655#include "CommandLineParser.h"
    5756
    58 // Boost 1.36 has some issues with deprecated functions that have been omitted
    59 #if (BOOST_VERSION == 103600)
    60 #  define BOOST_LEAF_FUNCTION filename
    61 #elif (BOOST_FILESYSTEM_VERSION < 3)
    62 #  define BOOST_LEAF_FUNCTION leaf
     57// Differentiate Boost Filesystem v2 and v3
     58#if (BOOST_FILESYSTEM_VERSION < 3)
     59#  define BF_LEAF leaf
     60#  define BF_GENERIC_STRING string
     61#  define BF_NATIVE_STRING file_string
    6362#else
    64 #  define BOOST_LEAF_FUNCTION path().filename().string
     63#  define BF_LEAF path().filename().string
     64#  define BF_GENERIC_STRING generic_string
     65#  define BF_NATIVE_STRING string
    6566#endif
    6667
     
    242243            {
    243244                ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
    244                                          Please remove " + it->first.string());
     245                                         Please remove " + it->first.BF_GENERIC_STRING());
    245246            }
    246247            if (bf::create_directories(it->first)) // function may not return true at all (bug?)
     
    261262        // Add that path to the PATH variable in case a module depends on another one
    262263        std::string pathVariable(getenv("PATH"));
    263         putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));
     264        putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.BF_NATIVE_STRING()).c_str()));
    264265
    265266        // Make sure the path exists, otherwise don't load modules
     
    273274        while (file != end)
    274275        {
    275             std::string filename = file->BOOST_LEAF_FUNCTION();
     276            std::string filename = file->BF_LEAF();
    276277
    277278            // Check if the file ends with the extension in question
     
    282283                    // We've found a helper file
    283284                    const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
    284 #if BOOST_FILESYSTEM_VERSION < 3
    285                     modulePaths.push_back((modulePath_ / library).file_string());
    286 #else
    287                     modulePaths.push_back((modulePath_ / library).string());
    288 #endif
     285                    modulePaths.push_back((modulePath_ / library).BF_NATIVE_STRING());
    289286                }
    290287            }
     
    297294    /*static*/ std::string PathConfig::getRootPathString()
    298295    {
    299         return getInstance().rootPath_.string() + '/';
     296        return getInstance().rootPath_.BF_GENERIC_STRING() + '/';
    300297    }
    301298
    302299    /*static*/ std::string PathConfig::getExecutablePathString()
    303300    {
    304         return getInstance().executablePath_.string() + '/';
     301        return getInstance().executablePath_.BF_GENERIC_STRING() + '/';
    305302    }
    306303
    307304    /*static*/ std::string PathConfig::getDataPathString()
    308305    {
    309         return getInstance().dataPath_.string() + '/';
     306        return getInstance().dataPath_.BF_GENERIC_STRING() + '/';
    310307    }
    311308
    312309    /*static*/ std::string PathConfig::getExternalDataPathString()
    313310    {
    314         return getInstance().externalDataPath_.string() + '/';
     311        return getInstance().externalDataPath_.BF_GENERIC_STRING() + '/';
    315312    }
    316313
    317314    /*static*/ std::string PathConfig::getConfigPathString()
    318315    {
    319         return getInstance().configPath_.string() + '/';
     316        return getInstance().configPath_.BF_GENERIC_STRING() + '/';
    320317    }
    321318
    322319    /*static*/ std::string PathConfig::getLogPathString()
    323320    {
    324         return getInstance().logPath_.string() + '/';
     321        return getInstance().logPath_.BF_GENERIC_STRING() + '/';
    325322    }
    326323
    327324    /*static*/ std::string PathConfig::getModulePathString()
    328325    {
    329         return getInstance().modulePath_.string() + '/';
     326        return getInstance().modulePath_.BF_GENERIC_STRING() + '/';
    330327    }
    331328}
  • code/branches/kicklib/src/libraries/core/Resource.cc

    r8081 r8225  
    3333#include <OgreFileSystem.h>
    3434#include <OgreResourceGroupManager.h>
     35
     36// Differentiate Boost Filesystem v2 and v3
     37#if (BOOST_FILESYSTEM_VERSION < 3)
     38#  define BF_GENERIC_STRING string
     39#else
     40#  define BF_GENERIC_STRING generic_string
     41#endif
    3542
    3643namespace orxonox
     
    98105                    boost::filesystem::path base(it->archive->getName());
    99106                    base /= it->filename;
    100                     ptr->fileSystemPath = base.string();
     107                    ptr->fileSystemPath = base.BF_GENERIC_STRING();
    101108                }
    102109                return ptr;
  • code/branches/kicklib/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r8066 r8225  
    3535
    3636#include <map>
    37 #include <boost/version.hpp>
    3837#include <boost/filesystem.hpp>
    3938
     
    4746#include "TclThreadManager.h"
    4847
    49 // Boost 1.36 has some issues with deprecated functions that have been omitted
    50 #if (BOOST_VERSION == 103600)
    51 #  define BOOST_LEAF_FUNCTION filename
    52 #  define BOOST_DICTIONARY_ENTRY_NAME string
    53 #elif (BOOST_FILESYSTEM_VERSION < 3)
    54 #  define BOOST_LEAF_FUNCTION leaf
    55 #  define BOOST_DICTIONARY_ENTRY_NAME string
     48// Differentiate Boost Filesystem v2 and v3
     49#if (BOOST_FILESYSTEM_VERSION < 3)
     50#  define BF_LEAF leaf
     51#  define BF_GENERIC_STRING string
     52#  define BF_DICTIONARY_ENTRY_NAME string
    5653#else
    57 #  define BOOST_LEAF_FUNCTION path().filename().string
    58 #  define BOOST_DICTIONARY_ENTRY_NAME path().string
     54#  define BF_LEAF path().filename().string
     55#  define BF_GENERIC_STRING generic_string
     56#  define BF_DICTIONARY_ENTRY_NAME path().string
    5957#endif
    6058
     
    250248                else
    251249                {
    252                     const std::string& dir = startdirectory.string();
     250                    const std::string& dir = startdirectory.BF_GENERIC_STRING();
    253251                    if (dir.size() > 0 && dir[dir.size() - 1] == ':')
    254252                        startdirectory = dir + '/';
     
    262260                {
    263261                    if (boost::filesystem::is_directory(*file))
    264                         dirlist.push_back(ArgumentCompletionListElement(file->BOOST_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BOOST_DICTIONARY_ENTRY_NAME()) + '/', file->BOOST_LEAF_FUNCTION() + '/'));
     262                        dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/'));
    265263                    else
    266                         filelist.push_back(ArgumentCompletionListElement(file->BOOST_DICTIONARY_ENTRY_NAME(), getLowercase(file->BOOST_DICTIONARY_ENTRY_NAME()), file->BOOST_LEAF_FUNCTION()));
     264                        filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF()));
    267265                    ++file;
    268266                }
Note: See TracChangeset for help on using the changeset viewer.