Core/Scripts: Fixed worldserver startup with hostwap enabled when ran in terminals that don't pass full path to argv[0]

This commit is contained in:
Shauren
2022-10-05 18:24:37 +02:00
parent 4301b8fcc9
commit bdf22f955d

View File

@@ -51,6 +51,7 @@ ScriptReloadMgr* ScriptReloadMgr::instance()
#include "Util.h"
#include "World.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/dll/runtime_symbol_info.hpp>
#include <boost/filesystem.hpp>
#include <boost/system/system_error.hpp>
#include <efsw/efsw.hpp>
@@ -108,14 +109,7 @@ typedef void* HandleType;
static fs::path GetDirectoryOfExecutable()
{
ASSERT((!sConfigMgr->GetArguments().empty()),
"Expected the arguments to contain at least 1 element!");
fs::path path(sConfigMgr->GetArguments()[0]);
if (path.is_absolute())
return path.parent_path();
else
return fs::canonical(fs::absolute(path)).parent_path();
return boost::dll::program_location().parent_path();
}
class SharedLibraryUnloader