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/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
Note: See TracChangeset for help on using the changeset viewer.