Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 11, 2011, 6:39:04 AM (13 years ago)
Author:
rgrieder
Message:

Attempt to fix Ogre plugins for Orxonox installations on Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/src/libraries/core/GraphicsManager.cc

    r8225 r8231  
    3030#include "GraphicsManager.h"
    3131
     32#include <cstdlib>
    3233#include <fstream>
    3334#include <sstream>
     
    6162#include "command/ConsoleCommand.h"
    6263
    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 
    7064namespace orxonox
    7165{
     
    148142        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
    149143            .description("Location of the Ogre config file");
    150         SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory)
    151             .description("Folder where the Ogre plugins are located.");
    152144        SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins)
    153145            .description("Comma separated list of all plugins to load.");
     
    241233    void GraphicsManager::loadOgrePlugins()
    242234    {
    243         // just to make sure the next statement doesn't segfault
    244         if (ogrePluginsDirectory_.empty())
    245             ogrePluginsDirectory_ = '.';
    246 
    247         boost::filesystem::path folder(ogrePluginsDirectory_);
     235        // Plugin path can have many different locations...
     236        std::string pluginPath = specialConfig::ogrePluginsDirectory;
     237#ifdef DEPENDENCY_PACKAGE_ENABLE
     238        if (!PathConfig::isDevelopmentRun())
     239        {
     240#  if defined(ORXONOX_PLATFORM_WINDOWS)
     241            pluginPath = PathConfig::getExecutablePathString();
     242#  elif defined(ORXONOX_PLATFORM_APPLE)
     243            // TODO: Where are the plugins being installed to?
     244            pluginPath = PathConfig::getExecutablePathString();
     245#  endif
     246        }
     247#endif
     248
     249        // Add OGRE plugin path to the environment. That way one plugin could
     250        // also depend on another without problems on Windows
     251        std::string pathVariable(getenv("PATH"));
     252        putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + pluginPath).c_str()));
     253
    248254        // Do some SubString magic to get the comma separated list of plugins
    249255        SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0');
    250         // Use backslash paths on Windows! file_string() already does that though.
    251256        for (unsigned int i = 0; i < plugins.size(); ++i)
    252             ogreRoot_->loadPlugin((folder / plugins[i]).BF_NATIVE_STRING());
     257            ogreRoot_->loadPlugin(plugins[i]);
    253258    }
    254259
Note: See TracChangeset for help on using the changeset viewer.