Revision: 8868
http://playerstage.svn.sourceforge.net/playerstage/?rev=8868&view=rev
Author: hsujohnhsu
Date: 2010-09-02 01:02:49 +0000 (Thu, 02 Sep 2010)
Log Message:
-----------
change gazebo config logic, environment variables preceeds .gazeborc preceeds
system default paths, mutually exclusive.
Modified Paths:
--------------
code/gazebo/branches/wg/server/GazeboConfig.cc
Modified: code/gazebo/branches/wg/server/GazeboConfig.cc
===================================================================
--- code/gazebo/branches/wg/server/GazeboConfig.cc 2010-09-02 00:47:35 UTC
(rev 8867)
+++ code/gazebo/branches/wg/server/GazeboConfig.cc 2010-09-02 01:02:49 UTC
(rev 8868)
@@ -51,17 +51,17 @@
{
std::ifstream cfgFile;
- std::string rcFilename = getenv("HOME");
- rcFilename += "/.gazeborc";
+ std::string rcFilename = getenv("GAZEBORC");
+ if (rcFilename.empty())
+ {
+ std::string rcFilename = getenv("HOME");
+ rcFilename += "/.gazeborc";
+ }
cfgFile.open(rcFilename.c_str(), std::ios::in);
std::string delim(":");
- char *ogre_resource_path = getenv("OGRE_RESOURCE_PATH");
- if(ogre_resource_path)
- this->AddOgrePaths(std::string(ogre_resource_path));
-
char *gazebo_resource_path = getenv("GAZEBO_RESOURCE_PATH");
if(gazebo_resource_path)
this->AddGazeboPaths(std::string(gazebo_resource_path));
@@ -70,25 +70,40 @@
if(gazebo_plugin_path)
this->AddPluginPaths(std::string(gazebo_plugin_path));
+ char *ogre_resource_path = getenv("OGRE_RESOURCE_PATH");
+ if(ogre_resource_path)
+ this->AddOgrePaths(std::string(ogre_resource_path));
+
if (cfgFile.is_open())
{
XMLConfig rc;
XMLConfigNode *node;
rc.Load(rcFilename);
- // if gazebo path is set, skip reading from .gazeborc
- if(!ogre_resource_path)
+ // if gazebo resource path is set, skip reading from .gazeborc
+ if(!gazebo_resource_path)
{
node = rc.GetRootNode()->GetChild("gazeboPath");
while (node)
{
gzmsg(5) << "Gazebo Path[" << node->GetValue() << "]\n";
- this->gazeboPaths.push_back(node->GetValue());
- this->AddPluginPaths(node->GetValue()+"/plugins");
+ this->AddGazeboPaths(node->GetValue());
node = node->GetNext("gazeboPath");
}
}
+ // if gazebo plugins path is set, skip reading from .gazeborc
+ if(!gazebo_plugin_path)
+ {
+ node = rc.GetRootNode()->GetChild("pluginPath");
+ while (node)
+ {
+ gzmsg(5) << "Gazebo Plugins Path[" << node->GetValue() << "]\n";
+ this->AddPluginPaths(node->GetValue());
+ node = node->GetNext("gazeboPath");
+ }
+ }
+
// if ogre path is set, skip reading from .gazeborc
if(!ogre_resource_path)
{
@@ -96,29 +111,32 @@
while (node)
{
gzmsg(5) << "Ogre Path[" << node->GetValue() << "]\n";
- this->ogrePaths.push_back( node->GetValue() );
+ this->AddOgrePaths( node->GetValue() );
node = node->GetNext("ogrePath");
}
}
}
- else
+
+ // add system paths if paths are empty
+ if (this->gazeboPaths.empty())
{
- gzmsg(0) << "Unable to find the file ~/.gazeborc. Using default paths.
This may cause OGRE to fail.\n";
+ gzmsg(0) << "No Gazebo media paths have been specified, using system
gazebo media paths.\n";
+ this->AddGazeboPaths("/usr/local/share/gazebo");
+ }
+ if (this->pluginPaths.empty())
+ {
+ gzmsg(0) << "No Gazebo plugin paths have been specified, using system
plugin paths.\n";
+ this->AddPluginPaths("/usr/local/share/gazebo/plugins");
+ }
- if (!gazebo_resource_path )
- {
- this->gazeboPaths.push_back("/usr/local/share/gazebo");
- this->AddPluginPaths("/usr/local/share/gazebo/plugins");
- }
+ if (this->ogrePaths.empty())
+ {
+ gzmsg(0) << "No Gazebo Ogre paths have been specified, using system ogre
paths.\n";
+ this->ogrePaths.push_back("/usr/local/lib/OGRE");
+ this->ogrePaths.push_back("/usr/lib/OGRE");
+ }
- if (!ogre_resource_path )
- {
- this->ogrePaths.push_back("/usr/local/lib/OGRE");
- this->ogrePaths.push_back("/usr/lib/OGRE");
- }
-
- }
}
std::list<std::string> &GazeboConfig::GetGazeboPaths()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit