1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-30 08:07:46 +00:00

show better errors for exd/config related issues

This commit is contained in:
NotAdam 2018-12-18 21:40:44 +11:00
parent d6deff3d2e
commit c4dd4b6b6b
4 changed files with 13 additions and 6 deletions

View file

@ -74,6 +74,7 @@ bool loadSettings( int32_t argc, char* argv[] )
if( !m_pConfig->loadConfig( configPath ) ) if( !m_pConfig->loadConfig( configPath ) )
{ {
g_log.fatal( "Error loading config " + configPath ); g_log.fatal( "Error loading config " + configPath );
g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
return false; return false;
} }
@ -140,9 +141,11 @@ bool loadSettings( int32_t argc, char* argv[] )
} }
g_log.info( "Setting up generated EXD data" ); g_log.info( "Setting up generated EXD data" );
if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" ) ) ) auto dataPath = m_pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" );
if( !g_exdDataGen.init( dataPath ) )
{ {
g_log.fatal( "Error setting up generated EXD data " ); g_log.fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
g_log.fatal( "DataPath: " + dataPath );
return false; return false;
} }

View file

@ -17,7 +17,7 @@ bool Sapphire::ConfigMgr::loadConfig( const std::string& configName )
if( !fs::exists( configFile ) ) if( !fs::exists( configFile ) )
{ {
if( !copyDefaultConfig( configName ) ) copyDefaultConfig( configName );
return false; return false;
} }

View file

@ -90,6 +90,7 @@ bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
if( !m_pConfig->loadConfig( m_configPath ) ) if( !m_pConfig->loadConfig( m_configPath ) )
{ {
g_log.fatal( "Error loading config " + m_configPath ); g_log.fatal( "Error loading config " + m_configPath );
g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
return false; return false;
} }
std::vector< std::string > args( argv + 1, argv + argc ); std::vector< std::string > args( argv + 1, argv + argc );

View file

@ -69,6 +69,7 @@ bool Sapphire::ServerMgr::loadSettings( int32_t argc, char* argv[] )
if( !pConfig->loadConfig( m_configName ) ) if( !pConfig->loadConfig( m_configName ) )
{ {
pLog->fatal( "Error loading config " + m_configName ); pLog->fatal( "Error loading config " + m_configName );
pLog->fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
return false; return false;
} }
@ -100,9 +101,11 @@ void Sapphire::ServerMgr::run( int32_t argc, char* argv[] )
pLog->info( "Setting up generated EXD data" ); pLog->info( "Setting up generated EXD data" );
auto pExdData = std::make_shared< Data::ExdDataGenerated >(); auto pExdData = std::make_shared< Data::ExdDataGenerated >();
if( !pExdData->init( pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" ) ) ) auto dataPath = pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" );
if( !pExdData->init( dataPath ) )
{ {
pLog->fatal( "Error setting up generated EXD data " ); pLog->fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
pLog->fatal( "DataPath: " + dataPath );
return; return;
} }
g_fw.set< Data::ExdDataGenerated >( pExdData ); g_fw.set< Data::ExdDataGenerated >( pExdData );