mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Create shared_memory directory from the config file if it doesn't exist on launch of shared_memory.exe
This commit is contained in:
@@ -36,6 +36,39 @@
|
||||
|
||||
EQEmuLogSys Log;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
inline bool MakeDirectory(const std::string &directory_name)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
struct _stat st;
|
||||
if (_stat(directory_name.c_str(), &st) == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
_mkdir(directory_name.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
struct stat st;
|
||||
if (stat(directory_name.c_str(), &st) == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
mkdir(directory_name.c_str(), 0755);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
@@ -62,6 +95,11 @@ int main(int argc, char **argv) {
|
||||
database.LoadLogSettings(Log.log_settings);
|
||||
Log.StartFileLogs();
|
||||
|
||||
std::string shared_mem_directory = Config->SharedMemDir;
|
||||
if (MakeDirectory(shared_mem_directory)) {
|
||||
Log.Out(Logs::General, Logs::Status, "Shared Memory folder doesn't exist, so we created it... '%s'", shared_mem_directory.c_str());
|
||||
}
|
||||
|
||||
database.LoadVariables();
|
||||
|
||||
/* If we're running shared memory and hotfix has no custom name, we probably want to start from scratch... */
|
||||
|
||||
Reference in New Issue
Block a user