gentoo/games-server/ghost++/files/ghost++-configpath.patch

42 lines
1.0 KiB
Diff

--- a/ghost/ghost.cpp
+++ b/ghost/ghost.cpp
@@ -233,15 +233,23 @@
{
srand( time( NULL ) );
+// we need a full path for the config file since we could install system-wide so the executable is not in the same place as the config --Dessa
+#ifdef CONFIGPATH
+ gCFGFile = CONFIGPATH "ghost.cfg";
+#else
gCFGFile = "ghost.cfg";
-
+#endif
if( argc > 1 && argv[1] )
gCFGFile = argv[1];
// read config file
CConfig CFG;
+#ifdef CONFIGPATH
+ CFG.Read( CONFIGPATH "default.cfg" );
+#else
CFG.Read( "default.cfg" );
+#endif
CFG.Read( gCFGFile );
gLogFile = CFG.GetString( "bot_log", string( ) );
gLogMethod = CFG.GetInt( "bot_logmethod", 1 );
@@ -1459,8 +1467,12 @@
void CGHost :: LoadIPToCountryData( )
{
ifstream in;
+// bah, why isn't that configurable? hardcode for now --Dessa
+#ifdef CONFIGPATH
+ in.open( CONFIGPATH "/ip-to-country.csv" );
+#else
in.open( "ip-to-country.csv" );
-
+#endif
if( in.fail( ) )
CONSOLE_Print( "[GHOST] warning - unable to read file [ip-to-country.csv], iptocountry data not loaded" );
else