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:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib2

  • code/branches/kicklib2/src/libraries/core/CorePrereqs.h

    r8284 r8285  
    262262namespace boost
    263263{
    264 #if BOOST_VERSION < 104400
     264#if (BOOST_VERSION < 104400)
     265
    265266    namespace filesystem
    266267    {
     
    269270        typedef basic_path<std::string, path_traits> path;
    270271    }
    271 #elif BOOST_VERSION < 104600
     272
     273#elif (BOOST_VERSION < 104800)
     274
     275# if BOOST_FILESYSTEM_VERSION == 2
    272276    namespace filesystem2
    273277    {
     
    282286        using filesystem2::path;
    283287    }
     288# elif BOOST_FILESYSTEM_VERSION == 3
     289    namespace filesystem3
     290    {
     291        class path;
     292    }
     293    namespace filesystem
     294    {
     295        using filesystem3::path;
     296    }
     297# endif
     298
    284299#else
    285     namespace filesystem3
     300
     301    // TODO: Check this once boost 1.48 is released
     302    namespace filesystem
    286303    {
    287304        class path;
    288305    }
    289     namespace filesystem
    290     {
    291         using filesystem3::path;
    292     }
     306
    293307#endif
     308
    294309    class thread;
    295310    class mutex;
  • code/branches/kicklib2/src/libraries/core/GraphicsManager.cc

    r8284 r8285  
    3030#include "GraphicsManager.h"
    3131
     32#include <cstdlib>
    3233#include <fstream>
    3334#include <sstream>
     
    120121        // Only for development runs
    121122        if (PathConfig::isDevelopmentRun())
    122         {
    123123            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getExternalDataPathString(), "FileSystem");
    124             extResources_.reset(new XMLFile("resources.oxr"));
    125             extResources_->setLuaSupport(false);
    126             Loader::open(extResources_.get());
    127         }
     124
     125        extResources_.reset(new XMLFile("resources.oxr"));
     126        extResources_->setLuaSupport(false);
     127        Loader::open(extResources_.get());
    128128
    129129        if (bLoadRenderer)
     
    150150        // Undeclare the resources
    151151        Loader::unload(resources_.get());
    152         if (PathConfig::isDevelopmentRun())
    153             Loader::unload(extResources_.get());
     152        Loader::unload(extResources_.get());
    154153    }
    155154
     
    158157        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
    159158            .description("Location of the Ogre config file");
    160         SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory)
    161             .description("Folder where the Ogre plugins are located.");
    162159        SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins)
    163160            .description("Comma separated list of all plugins to load.");
     
    251248    void GraphicsManager::loadOgrePlugins()
    252249    {
    253         // just to make sure the next statement doesn't segfault
    254         if (ogrePluginsDirectory_.empty())
    255             ogrePluginsDirectory_ = '.';
    256 
    257         boost::filesystem::path folder(ogrePluginsDirectory_);
     250        // Plugin path can have many different locations...
     251        std::string pluginPath = specialConfig::ogrePluginsDirectory;
     252#ifdef DEPENDENCY_PACKAGE_ENABLE
     253        if (!PathConfig::isDevelopmentRun())
     254        {
     255#  if defined(ORXONOX_PLATFORM_WINDOWS)
     256            pluginPath = PathConfig::getExecutablePathString();
     257#  elif defined(ORXONOX_PLATFORM_APPLE)
     258            // TODO: Where are the plugins being installed to?
     259            pluginPath = PathConfig::getExecutablePathString();
     260#  endif
     261        }
     262#endif
     263
     264#ifdef ORXONOX_PLATFORM_WINDOWS
     265        // Add OGRE plugin path to the environment. That way one plugin could
     266        // also depend on another without problems on Windows
     267        const char* currentPATH = getenv("PATH");
     268        std::string newPATH = pluginPath;
     269        if (currentPATH != NULL)
     270            newPATH = std::string(currentPATH) + ';' + newPATH;
     271        putenv(const_cast<char*>(("PATH=" + newPATH).c_str()));
     272#endif
     273
    258274        // Do some SubString magic to get the comma separated list of plugins
    259275        SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0');
    260         // Use backslash paths on Windows! file_string() already does that though.
    261276        for (unsigned int i = 0; i < plugins.size(); ++i)
    262 #if BOOST_FILESYSTEM_VERSION < 3
    263             ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
    264 #else
    265             ogreRoot_->loadPlugin((folder / plugins[i]).string());
    266 #endif
     277            ogreRoot_->loadPlugin(pluginPath + '/' + plugins[i]);
    267278    }
    268279
     
    290301
    291302        Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_.get());
    292 
    293 // HACK
    294 #ifdef ORXONOX_PLATFORM_APPLE
    295         //INFO: This will give our window focus, and not lock it to the terminal
    296         ProcessSerialNumber psn = {0, kCurrentProcess};
    297         TransformProcessType(&psn, kProcessTransformToForegroundApplication);
    298         SetFrontProcess(&psn);
    299 #endif
    300 // End of HACK
    301303
    302304        // create a full screen default viewport
  • code/branches/kicklib2/src/libraries/core/GraphicsManager.h

    r8283 r8285  
    128128        // config values
    129129        std::string         ogreConfigFile_;           //!< ogre config filename
    130         std::string         ogrePluginsDirectory_;     //!< Directory where the Ogre plugins are located
    131130        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
    132131        std::string         ogreLogFile_;              //!< log filename for Ogre log messages
  • code/branches/kicklib2/src/libraries/core/Identifier.h

    r8284 r8285  
    395395    {
    396396        // Get the name of the class
    397         const std::string& name = typeid(T).name();
     397        std::string name = typeid(T).name();
    398398
    399399        // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
  • 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}
  • code/branches/kicklib2/src/libraries/core/PathConfig.h

    r7427 r8285  
    113113            static std::string getModulePathString();
    114114
    115             //! Return trrue for runs in the build directory (not installed)
     115            //! Return true for runs in the build directory (not installed)
    116116            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
    117117
  • code/branches/kicklib2/src/libraries/core/Resource.cc

    r8284 r8285  
    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/kicklib2/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r8284 r8285  
    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.