Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2011, 7:43:10 PM (13 years ago)
Author:
rgrieder
Message:

Merged revisions 8098 - 8277 from kicklib to kicklib2.

Location:
code/branches/kicklib2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib2

  • code/branches/kicklib2/src/libraries/core/PathConfig.cc

    r8284 r8285  
    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?)
     
    259260        size_t moduleextensionlength = moduleextension.size();
    260261
     262#ifdef ORXONOX_PLATFORM_WINDOWS
    261263        // Add that path to the PATH variable in case a module depends on another one
    262         std::string pathVariable(getenv("PATH"));
    263         putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));
     264        const char* currentPATH = getenv("PATH");
     265        std::string newPATH = modulePath_.BF_NATIVE_STRING();
     266        if (currentPATH != NULL)
     267            newPATH = std::string(currentPATH) + ';' + newPATH;
     268        putenv(const_cast<char*>(("PATH=" + newPATH).c_str()));
     269#endif
    264270
    265271        // Make sure the path exists, otherwise don't load modules
     
    273279        while (file != end)
    274280        {
    275             std::string filename = file->BOOST_LEAF_FUNCTION();
     281            std::string filename = file->BF_LEAF();
    276282
    277283            // Check if the file ends with the extension in question
     
    282288                    // We've found a helper file
    283289                    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
     290                    modulePaths.push_back(getModulePathString() + library);
    289291                }
    290292            }
     
    297299    /*static*/ std::string PathConfig::getRootPathString()
    298300    {
    299         return getInstance().rootPath_.string() + '/';
     301        return getInstance().rootPath_.BF_GENERIC_STRING() + '/';
    300302    }
    301303
    302304    /*static*/ std::string PathConfig::getExecutablePathString()
    303305    {
    304         return getInstance().executablePath_.string() + '/';
     306        return getInstance().executablePath_.BF_GENERIC_STRING() + '/';
    305307    }
    306308
    307309    /*static*/ std::string PathConfig::getDataPathString()
    308310    {
    309         return getInstance().dataPath_.string() + '/';
     311        return getInstance().dataPath_.BF_GENERIC_STRING() + '/';
    310312    }
    311313
    312314    /*static*/ std::string PathConfig::getExternalDataPathString()
    313315    {
    314         return getInstance().externalDataPath_.string() + '/';
     316        return getInstance().externalDataPath_.BF_GENERIC_STRING() + '/';
    315317    }
    316318
    317319    /*static*/ std::string PathConfig::getConfigPathString()
    318320    {
    319         return getInstance().configPath_.string() + '/';
     321        return getInstance().configPath_.BF_GENERIC_STRING() + '/';
    320322    }
    321323
    322324    /*static*/ std::string PathConfig::getLogPathString()
    323325    {
    324         return getInstance().logPath_.string() + '/';
     326        return getInstance().logPath_.BF_GENERIC_STRING() + '/';
    325327    }
    326328
    327329    /*static*/ std::string PathConfig::getModulePathString()
    328330    {
    329         return getInstance().modulePath_.string() + '/';
     331        return getInstance().modulePath_.BF_GENERIC_STRING() + '/';
    330332    }
    331333}
Note: See TracChangeset for help on using the changeset viewer.