Replaced getenv(..) usage with osg::getEnvVar(..)

This commit is contained in:
Robert Osfield 2017-11-01 13:54:15 +00:00
parent 51a9c66856
commit fbb7270e55

View File

@ -34,6 +34,8 @@
#include <osgViewer/config/PanoramicSphericalDisplay> #include <osgViewer/config/PanoramicSphericalDisplay>
#include <osgViewer/config/WoWVxDisplay> #include <osgViewer/config/WoWVxDisplay>
#include <osg/EnvVar>
#include <sstream> #include <sstream>
#include <string.h> #include <string.h>
@ -495,26 +497,18 @@ void Viewer::realize()
// no windows are already set up so set up a default view // no windows are already set up so set up a default view
const char* ptr = 0; std::string value;
if ((ptr = getenv("OSG_CONFIG_FILE")) != 0) if (osg::getEnvVar("OSG_CONFIG_FILE", value))
{ {
readConfiguration(ptr); readConfiguration(value);
} }
else else
{ {
int screenNum = -1; int screenNum = -1;
if ((ptr = getenv("OSG_SCREEN")) != 0) osg::getEnvVar("OSG_SCREEN", screenNum);
{
if (strlen(ptr)!=0) screenNum = atoi(ptr);
else screenNum = -1;
}
int x = -1, y = -1, width = -1, height = -1; int x = -1, y = -1, width = -1, height = -1;
if ((ptr = getenv("OSG_WINDOW")) != 0) osg::getEnvVar("OSG_WINDOW", x, y, width, height);
{
std::istringstream iss(ptr);
iss >> x >> y >> width >> height;
}
if (width>0 && height>0) if (width>0 && height>0)
{ {