mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +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:
@@ -64,6 +64,7 @@
|
||||
#include "ScriptedActivityComponent.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "AssetManager.h"
|
||||
#include "BinaryPathFinder.h"
|
||||
|
||||
void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr) {
|
||||
std::string chatCommand;
|
||||
@@ -248,7 +249,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
if (chatCommand == "credits" || chatCommand == "info") {
|
||||
const auto& customText = chatCommand == "credits" ? VanityUtilities::ParseMarkdown("./vanity/CREDITS.md") : VanityUtilities::ParseMarkdown("./vanity/INFO.md");
|
||||
const auto& customText = chatCommand == "credits" ? VanityUtilities::ParseMarkdown((BinaryPathFinder::GetBinaryDir() / "vanity/CREDITS.md").string()) : VanityUtilities::ParseMarkdown((BinaryPathFinder::GetBinaryDir() / "vanity/INFO.md").string());
|
||||
|
||||
{
|
||||
AMFArrayValue args;
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "tinyxml2.h"
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "BinaryPathFinder.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -27,7 +28,7 @@ void VanityUtilities::SpawnVanity() {
|
||||
|
||||
const uint32_t zoneID = Game::server->GetZoneID();
|
||||
|
||||
ParseXML("./vanity/NPC.xml");
|
||||
ParseXML((BinaryPathFinder::GetBinaryDir() / "vanity/NPC.xml").string());
|
||||
|
||||
// Loop through all parties
|
||||
for (const auto& party : m_Parties) {
|
||||
@@ -131,7 +132,7 @@ void VanityUtilities::SpawnVanity() {
|
||||
info.spawnerID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
|
||||
|
||||
info.settings = { new LDFData<bool>(u"hasCustomText", true),
|
||||
new LDFData<std::string>(u"customText", ParseMarkdown("./vanity/TESTAMENT.md")) };
|
||||
new LDFData<std::string>(u"customText", ParseMarkdown((BinaryPathFinder::GetBinaryDir() / "vanity/TESTAMENT.md").string())) };
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
|
@@ -9,13 +9,14 @@
|
||||
#include "tinyxml2.h"
|
||||
#include "Game.h"
|
||||
#include "dConfig.h"
|
||||
#include "BinaryPathFinder.h"
|
||||
|
||||
dLocale::dLocale() {
|
||||
if (Game::config->GetValue("locale_enabled") != "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream file(m_LocalePath);
|
||||
std::ifstream file(BinaryPathFinder::GetBinaryDir() / m_LocalePath);
|
||||
|
||||
if (!file.good()) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user