1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 21:57:44 +00:00

Merge pull request #184 from ayyaruq/bugfix/183-hardcoded-chaiscripts-path

Fix #183 hardcoded Chai scripts path
This commit is contained in:
Mordred 2017-11-25 22:22:23 +01:00 committed by GitHub
commit 7ed3ee6f80
4 changed files with 13 additions and 2 deletions

View file

@ -7,6 +7,8 @@
<ListenIp>127.0.0.1</ListenIp>
<!-- Path of FFXIV dat files -->
<DataPath>C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv</DataPath>
<!-- Path of Chai script files -->
<ScriptPath>../scripts/chai</ScriptPath>
<!-- Connection settings for the mysql db -->
<Mysql>
<Host>127.0.0.1</Host>

View file

@ -38,6 +38,8 @@ Core::Scripting::ScriptManager::~ScriptManager()
void Core::Scripting::ScriptManager::loadDir( std::string dirname, std::set<std::string>& chaiFiles )
{
g_log.info( "ScriptEngine: loading scripts from " + dirname );
boost::filesystem::path targetDir( dirname );
boost::filesystem::recursive_directory_iterator iter( targetDir ), eod;

View file

@ -1,8 +1,11 @@
#include <chaiscript/chaiscript.hpp>
#include <Server_Common/Config/XMLConfig.h>
#include <Server_Common/Logging/Logger.h>
#include <Server_Common/Script/ChaiscriptStdLib.h>
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Script/ScriptManager.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
@ -17,6 +20,7 @@
#include <boost/lexical_cast.hpp>
extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
int Core::Scripting::ScriptManager::init()
{
@ -169,8 +173,7 @@ int Core::Scripting::ScriptManager::init()
std::set< std::string > chaiFiles;
g_log.info( "ScriptEngine: Loading Scripts..." );
loadDir( "../scripts/chai", chaiFiles );
loadDir( g_serverZone.getConfig()->getValue< std::string >( "Settings.General.ScriptPath", "../scripts/chai" ), chaiFiles );
uint16_t scriptCount = 0;
uint16_t errorCount = 0;

View file

@ -129,6 +129,10 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
{
m_pConfig->setValue< std::string >( "Settings.General.DataPath", val );
}
else if( arg == "s" || arg == "scriptpath" )
{
m_pConfig->setValue< std::string >( "Settings.General.ScriptPath", val );
}
else if( arg == "h" || arg == "dbhost" )
{
m_pConfig->setValue< std::string >( "Settings.General.Mysql.Host", val );