1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-05-01 09:11:25 +00:00
openmw/components/ogreinit/ogreplugin.cpp
slothlife 46eb20b98c Fixes for warnings when building with MSVC
Most warnings are innocuous (wrong type-specifier for forward
declarations, conversion of literals into unsigned integers, warnings
about methods optimized out), but I believe actual bugs were revealed in
vartypedelegate.cpp and combat.cpp.
2014-05-09 08:32:52 -05:00

45 lines
1.1 KiB
C++

#include "ogreplugin.hpp"
#include <OgrePrerequisites.h>
#include <OgreRoot.h>
namespace Files {
bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot) {
std::string pluginExt;
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
pluginExt = ".dll";
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
pluginExt = ".framework";
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
pluginExt = ".so";
#endif
// Append plugin suffix if debugging.
std::string pluginPath;
#if defined(DEBUG)
pluginPath = pluginDir + "/" + pluginName + OGRE_PLUGIN_DEBUG_SUFFIX + pluginExt;
if (boost::filesystem::exists(pluginPath)) {
ogreRoot.loadPlugin(pluginPath);
return true;
}
else {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
return false;
#endif //OGRE_PLATFORM == OGRE_PLATFORM_WIN32
}
#else //!defined(DEBUG)
pluginPath = pluginDir + "/" + pluginName + pluginExt;
if (boost::filesystem::exists(pluginPath)) {
ogreRoot.loadPlugin(pluginPath);
return true;
}
else {
return false;
}
#endif
}
}