Reordered command line parsing and replace throw with cout.

This commit is contained in:
Robert Osfield 2017-03-30 13:21:05 +01:00
parent e2d4ebbe55
commit a6baf00956
2 changed files with 18 additions and 13 deletions

View File

@ -402,6 +402,20 @@ int main( int argc, char **argv )
std::string address;
std::string port;
while (arguments.read("--address", address)) {}
while (arguments.read("--port", port)) {}
bool use_zeroconf(false);
bool use_sender(false);
bool use_receiver(false);
if(arguments.find("--zeroconf") > 0) { use_zeroconf = true; }
if(arguments.find("--sender") > 0) { use_sender = true; }
if(arguments.find("--receiver") > 0) { use_receiver = true; }
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
@ -414,18 +428,6 @@ int main( int argc, char **argv )
scene = geode;
}
std::string address;
std::string port;
bool use_zeroconf(false);
bool use_sender(false);
bool use_receiver(false);
if(arguments.find("--zeroconf") > 0) { use_zeroconf = true; }
if(arguments.find("--sender") > 0) { use_sender = true; }
if(arguments.find("--receiver") > 0) { use_receiver = true; }
while (arguments.read("--address", address)) {}
while (arguments.read("--port", port)) {}
// construct the viewer.
osgViewer::CompositeViewer viewer(arguments);

View File

@ -32,6 +32,7 @@
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <assert.h>
#include <signal.h>
#include <math.h>
@ -185,7 +186,9 @@ public:
{
std::string errorString("error when calling send : ");
errorString += strerror(errno);
throw std::runtime_error(errorString);
std::cout<<errorString<<std::endl;
// throw std::runtime_error(errorString);
}
}