mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2025-07-02 03:15:24 +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.TriggerClientEvent` not kicking the client if it failed
|
||||
- FIXED Lua result queue handling not checking all results
|
||||
- FIXED bug which caused ServerConfig.toml to generate incorrectly
|
||||
|
||||
# v3.0.1
|
||||
|
||||
|
@ -92,13 +92,20 @@ void TConfig::FlushToFile() {
|
||||
data["HTTP"][StrHTTPServerEnabled.data()] = Application::Settings.HTTPServerEnabled;
|
||||
SetComment(data["HTTP"][StrHTTPServerEnabled.data()].comments(), " Enables the internal HTTP server");
|
||||
std::stringstream Ss;
|
||||
Ss << data;
|
||||
std::ofstream Stream(mConfigFileName, std::ios::trunc | std::ios::out);
|
||||
Stream << "# This is the BeamMP-Server config file.\n"
|
||||
"# Help & Documentation: `https://wiki.beammp.com/en/home/server-maintenance`\n"
|
||||
"# IMPORTANT: Fill in the AuthKey with the key you got from `https://beammp.com/k/dashboard` on the left under \"Keys\"\n"
|
||||
<< Ss.str();
|
||||
Stream.flush();
|
||||
Ss << "# This is the BeamMP-Server config file.\n"
|
||||
"# Help & Documentation: `https://wiki.beammp.com/en/home/server-maintenance`\n"
|
||||
"# IMPORTANT: Fill in the AuthKey with the key you got from `https://beammp.com/k/dashboard` on the left under \"Keys\"\n"
|
||||
<< data;
|
||||
auto File = std::fopen(mConfigFileName.c_str(), "w+");
|
||||
if (!File) {
|
||||
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) {
|
||||
@ -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()));
|
||||
}
|
||||
|
||||
{ // create file context
|
||||
std::ofstream ofs(name.data());
|
||||
}
|
||||
|
||||
FlushToFile();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user