mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-07 19:24:08 +00:00
Allow servers to be run from directories other than build
. Read/write files relative to binary instead of cwd (#834)
Allows the server to be run from a non-build directory. Also only read or write files relative to the build directory, regardless of where the server is run from
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "dMessageIdentifiers.h"
|
||||
#include "MasterPackets.h"
|
||||
#include "PacketUtils.h"
|
||||
#include "BinaryPathFinder.h"
|
||||
|
||||
InstanceManager::InstanceManager(dLogger* logger, const std::string& externalIP) {
|
||||
mLogger = logger;
|
||||
@@ -48,13 +49,13 @@ Instance* InstanceManager::GetInstance(LWOMAPID mapID, bool isFriendTransfer, LW
|
||||
|
||||
//Start the actual process:
|
||||
#ifdef _WIN32
|
||||
std::string cmd = "start ./WorldServer.exe -zone ";
|
||||
std::string cmd = "start " + (BinaryPathFinder::GetBinaryDir() / "WorldServer.exe").string() + " -zone ";
|
||||
#else
|
||||
std::string cmd;
|
||||
if (std::atoi(Game::config->GetValue("use_sudo_world").c_str())) {
|
||||
cmd = "sudo ./WorldServer -zone ";
|
||||
cmd = "sudo " + (BinaryPathFinder::GetBinaryDir() / "WorldServer").string() + " -zone ";
|
||||
} else {
|
||||
cmd = "./WorldServer -zone ";
|
||||
cmd = (BinaryPathFinder::GetBinaryDir() / "WorldServer").string() + " -zone ";
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -300,10 +301,10 @@ Instance* InstanceManager::CreatePrivateInstance(LWOMAPID mapID, LWOCLONEID clon
|
||||
instance = new Instance(mExternalIP, port, mapID, ++m_LastInstanceID, cloneID, maxPlayers, maxPlayers, true, password);
|
||||
|
||||
//Start the actual process:
|
||||
std::string cmd = "start ./WorldServer.exe -zone ";
|
||||
std::string cmd = "start " + (BinaryPathFinder::GetBinaryDir() / "WorldServer").string() + " -zone ";
|
||||
|
||||
#ifndef _WIN32
|
||||
cmd = "./WorldServer -zone ";
|
||||
cmd = (BinaryPathFinder::GetBinaryDir() / "WorldServer").string() + " -zone ";
|
||||
#endif
|
||||
|
||||
cmd.append(std::to_string(mapID));
|
||||
|
Reference in New Issue
Block a user