[Orxonox-commit 3586] r8271 - code/branches/kicklib/src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Wed Apr 20 00:10:37 CEST 2011


Author: rgrieder
Date: 2011-04-20 00:10:36 +0200 (Wed, 20 Apr 2011)
New Revision: 8271

Modified:
   code/branches/kicklib/src/libraries/core/GraphicsManager.cc
   code/branches/kicklib/src/libraries/core/PathConfig.cc
   code/branches/kicklib/src/libraries/core/PathConfig.h
Log:
Fixed PATH fiddling for module/plugin loading.

Modified: code/branches/kicklib/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/GraphicsManager.cc	2011-04-19 21:20:46 UTC (rev 8270)
+++ code/branches/kicklib/src/libraries/core/GraphicsManager.cc	2011-04-19 22:10:36 UTC (rev 8271)
@@ -246,10 +246,15 @@
         }
 #endif
 
+#ifdef ORXONOX_PLATFORM_WINDOWS
         // Add OGRE plugin path to the environment. That way one plugin could
         // also depend on another without problems on Windows
-        std::string pathVariable(getenv("PATH"));
-        putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + pluginPath).c_str()));
+        const char* currentPATH = getenv("PATH");
+        std::string newPATH = pluginPath;
+        if (currentPATH != NULL)
+            newPATH = std::string(currentPATH) + ';' + newPATH;
+        putenv(const_cast<char*>(("PATH=" + newPATH).c_str()));
+#endif
 
         // Do some SubString magic to get the comma separated list of plugins
         SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0');

Modified: code/branches/kicklib/src/libraries/core/PathConfig.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/PathConfig.cc	2011-04-19 21:20:46 UTC (rev 8270)
+++ code/branches/kicklib/src/libraries/core/PathConfig.cc	2011-04-19 22:10:36 UTC (rev 8271)
@@ -259,9 +259,14 @@
         const std::string& moduleextension = specialConfig::moduleExtension;
         size_t moduleextensionlength = moduleextension.size();
 
+#ifdef ORXONOX_PLATFORM_WINDOWS
         // Add that path to the PATH variable in case a module depends on another one
-        std::string pathVariable(getenv("PATH"));
-        putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.BF_NATIVE_STRING()).c_str()));
+        const char* currentPATH = getenv("PATH");
+        std::string newPATH = modulePath_.BF_NATIVE_STRING();
+        if (currentPATH != NULL)
+            newPATH = std::string(currentPATH) + ';' + newPATH;
+        putenv(const_cast<char*>(("PATH=" + newPATH).c_str()));
+#endif
 
         // Make sure the path exists, otherwise don't load modules
         if (!boost::filesystem::exists(modulePath_))

Modified: code/branches/kicklib/src/libraries/core/PathConfig.h
===================================================================
--- code/branches/kicklib/src/libraries/core/PathConfig.h	2011-04-19 21:20:46 UTC (rev 8270)
+++ code/branches/kicklib/src/libraries/core/PathConfig.h	2011-04-19 22:10:36 UTC (rev 8271)
@@ -112,7 +112,7 @@
             //! Returns the path to the modules as std::string
             static std::string getModulePathString();
 
-            //! Return trrue for runs in the build directory (not installed)
+            //! Return true for runs in the build directory (not installed)
             static bool isDevelopmentRun() { return getInstance().bDevRun_; }
 
         private:




More information about the Orxonox-commit mailing list