mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 14:58:27 +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:
@@ -1,9 +1,10 @@
|
||||
#include "dConfig.h"
|
||||
#include <sstream>
|
||||
#include "BinaryPathFinder.h"
|
||||
|
||||
dConfig::dConfig(const std::string& filepath) {
|
||||
m_EmptyString = "";
|
||||
std::ifstream in(filepath);
|
||||
std::ifstream in(BinaryPathFinder::GetBinaryDir() / filepath);
|
||||
if (!in.good()) return;
|
||||
|
||||
std::string line;
|
||||
@@ -13,7 +14,7 @@ dConfig::dConfig(const std::string& filepath) {
|
||||
}
|
||||
}
|
||||
|
||||
std::ifstream sharedConfig("sharedconfig.ini", std::ios::in);
|
||||
std::ifstream sharedConfig(BinaryPathFinder::GetBinaryDir() / "sharedconfig.ini", std::ios::in);
|
||||
if (!sharedConfig.good()) return;
|
||||
|
||||
while (std::getline(sharedConfig, line)) {
|
||||
|
Reference in New Issue
Block a user