mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2025-07-02 10:55:25 +00:00
another attempt to fix #105
This commit is contained in:
parent
696e080e1c
commit
38eeec39b4
@ -7,6 +7,7 @@
|
|||||||
- FIXED `MP.CreateEventTimer` filling up the queue (see <https://wiki.beammp.com/en/Scripting/new-lua-scripting#mpcreateeventtimerevent_name-string-interval_ms-number-strategy-number-since-v302>)
|
- FIXED `MP.CreateEventTimer` filling up the queue (see <https://wiki.beammp.com/en/Scripting/new-lua-scripting#mpcreateeventtimerevent_name-string-interval_ms-number-strategy-number-since-v302>)
|
||||||
- FIXED `MP.TriggerClientEvent` not kicking the client if it failed
|
- FIXED `MP.TriggerClientEvent` not kicking the client if it failed
|
||||||
- FIXED Lua result queue handling not checking all results
|
- FIXED Lua result queue handling not checking all results
|
||||||
|
- FIXED bug which caused ServerConfig.toml to generate incorrectly
|
||||||
|
|
||||||
# v3.0.1
|
# v3.0.1
|
||||||
|
|
||||||
|
@ -92,13 +92,20 @@ void TConfig::FlushToFile() {
|
|||||||
data["HTTP"][StrHTTPServerEnabled.data()] = Application::Settings.HTTPServerEnabled;
|
data["HTTP"][StrHTTPServerEnabled.data()] = Application::Settings.HTTPServerEnabled;
|
||||||
SetComment(data["HTTP"][StrHTTPServerEnabled.data()].comments(), " Enables the internal HTTP server");
|
SetComment(data["HTTP"][StrHTTPServerEnabled.data()].comments(), " Enables the internal HTTP server");
|
||||||
std::stringstream Ss;
|
std::stringstream Ss;
|
||||||
Ss << data;
|
Ss << "# This is the BeamMP-Server config file.\n"
|
||||||
std::ofstream Stream(mConfigFileName, std::ios::trunc | std::ios::out);
|
"# Help & Documentation: `https://wiki.beammp.com/en/home/server-maintenance`\n"
|
||||||
Stream << "# This is the BeamMP-Server config file.\n"
|
"# IMPORTANT: Fill in the AuthKey with the key you got from `https://beammp.com/k/dashboard` on the left under \"Keys\"\n"
|
||||||
"# Help & Documentation: `https://wiki.beammp.com/en/home/server-maintenance`\n"
|
<< data;
|
||||||
"# IMPORTANT: Fill in the AuthKey with the key you got from `https://beammp.com/k/dashboard` on the left under \"Keys\"\n"
|
auto File = std::fopen(mConfigFileName.c_str(), "w+");
|
||||||
<< Ss.str();
|
if (!File) {
|
||||||
Stream.flush();
|
beammp_error("Failed to create/write to config file: " + GetPlatformAgnosticErrorString());
|
||||||
|
throw std::runtime_error("Failed to create/write to config file");
|
||||||
|
}
|
||||||
|
auto Str = Ss.str();
|
||||||
|
auto N = std::fwrite(Str.data(), sizeof(char), Str.size(), File);
|
||||||
|
if (N != Str.size()) {
|
||||||
|
beammp_error("Failed to write to config file properly, config file might be misshapen");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TConfig::CreateConfigFile(std::string_view name) {
|
void TConfig::CreateConfigFile(std::string_view name) {
|
||||||
@ -113,10 +120,6 @@ void TConfig::CreateConfigFile(std::string_view name) {
|
|||||||
beammp_error("an error occurred and was ignored during config transfer: " + std::string(e.what()));
|
beammp_error("an error occurred and was ignored during config transfer: " + std::string(e.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // create file context
|
|
||||||
std::ofstream ofs(name.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
FlushToFile();
|
FlushToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user