Commit 63f867f9 authored by Jonas Stienen's avatar Jonas Stienen

Adding version report with flag "--version"

parent 21c8e0f2
......@@ -35,7 +35,10 @@ int main( int argc, char* argv[] )
{
// Arguments
bool bVersionInfoRequest = false;
std::string sServerAddress, sVACoreConfigPath;
if( argc == 1 )
{
sServerAddress = "0.0.0.0:12340";
......@@ -49,17 +52,25 @@ int main( int argc, char* argv[] )
}
else
{
if( argc == 2 )
{
const string sCommand( argv[ 1 ] );
if( sCommand == "--version" || sCommand == "-v" || sCommand == "-version" )
bVersionInfoRequest = true;
}
if( argc >= 2 )
sServerAddress = argv[1];
if( argc >= 3 )
sVACoreConfigPath = argv[2];
}
// Server
IVANetServer* pServer = IVANetServer::Create();
std::string sServer;
// Core
IVACore* pCore = NULL;
IVANetServer* pServer = NULL;
try
{
......@@ -100,15 +111,28 @@ int main( int argc, char* argv[] )
pCore = VACore::CreateCoreInstance( sVACoreConfigPath );
}
// Set up the network server
int iPort;
SplitServerString( sServerAddress, sServer, iPort );
CVACoreVersionInfo ver;
pCore->GetVersionInfo(&ver);
cout << ver.ToString() << " initializing ..." << endl << endl;
pCore->GetVersionInfo( &ver );
cout << ver.ToString() << endl;
// If only version requested, exit.
if( bVersionInfoRequest )
{
delete pCore;
return 0;
}
pCore->Initialize();
// Server
pServer = IVANetServer::Create();
std::string sServer;
// Set up the network connection
int iPort;
SplitServerString( sServerAddress, sServer, iPort );
pServer->SetCoreInstance(pCore);
if ((ec = pServer->Initialize(sServer, iPort)) != 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment