Revision: 8767
http://playerstage.svn.sourceforge.net/playerstage/?rev=8767&view=rev
Author: hsujohnhsu
Date: 2010-06-19 07:53:59 +0000 (Sat, 19 Jun 2010)
Log Message:
-----------
bug fix: setup rt shader lib cache in tmp directory.
Modified Paths:
--------------
code/gazebo/trunk/server/rendering/RTShaderSystem.cc
Modified: code/gazebo/trunk/server/rendering/RTShaderSystem.cc
===================================================================
--- code/gazebo/trunk/server/rendering/RTShaderSystem.cc 2010-06-15
18:50:40 UTC (rev 8766)
+++ code/gazebo/trunk/server/rendering/RTShaderSystem.cc 2010-06-19
07:53:59 UTC (rev 8767)
@@ -26,6 +26,7 @@
#include <boost/bind.hpp>
#include <sys/stat.h>
+#include <iostream>
#include "OgreVisual.hh"
#include "World.hh"
@@ -33,6 +34,7 @@
#include "GazeboMessage.hh"
#include "OgreAdaptor.hh"
#include "RTShaderSystem.hh"
+#include "gz.h"
#define MINOR_VERSION 7
using namespace gazebo;
@@ -56,13 +58,11 @@
#if OGRE_VERSION_MAJOR >= 1 && OGRE_VERSION_MINOR >= MINOR_VERSION
if (Ogre::RTShader::ShaderGenerator::initialize())
{
- Ogre::StringVector groupVector;
-
this->shaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
this->shaderGenerator->addSceneManager(OgreAdaptor::Instance()->sceneMgr);
// Setup the core libraries and shader cache path
- groupVector =
Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
+ Ogre::StringVector groupVector =
Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
Ogre::StringVector::iterator itGroup = groupVector.begin();
Ogre::StringVector::iterator itGroupEnd = groupVector.end();
Ogre::String shaderCoreLibsPath;
@@ -90,7 +90,35 @@
if ((*it)->archive->getName().find("rtshaderlib") !=
Ogre::String::npos)
{
shaderCoreLibsPath = (*it)->archive->getName() + "/";
- shaderCachePath = shaderCoreLibsPath;
+
+ // setup patch name for rt shader cache in tmp
+ char *tmpdir;
+ char *user;
+ std::ostringstream stream;
+ std::ostringstream errStream;
+ // Get the tmp dir
+ tmpdir = getenv("TMP");
+ if (!tmpdir)
+ tmpdir = (char*)"/tmp";
+ // Get the user
+ user = getenv("USER");
+ if (!user)
+ user = (char*)"nobody";
+ stream << tmpdir << "/gazebo-" << user << "-rtshaderlibcache" <<
"/";
+ shaderCachePath = stream.str();
+ struct stat astat;
+ // Create the directory
+ if (mkdir(shaderCachePath.c_str(), S_IRUSR | S_IWUSR | S_IXUSR) !=
0)
+ {
+ if (errno != EEXIST)
+ {
+ errStream << "failed to create [" << shaderCachePath << "] : ["
+ << strerror(errno) << "]";
+ throw(errStream.str());
+ }
+
+ }
+
coreLibsFound = true;
break;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit