mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #7772 from Robyt3/Config-Save-Error-Improvements
Improve error messages when saving settings fails
This commit is contained in:
commit
d6c10233ed
|
@ -2997,7 +2997,11 @@ void CClient::Run()
|
|||
{
|
||||
// write down the config and quit
|
||||
if(!m_pConfigManager->Save())
|
||||
m_vWarnings.emplace_back(Localize("Saving ddnet-settings.cfg failed"));
|
||||
{
|
||||
char aWarning[128];
|
||||
str_format(aWarning, sizeof(aWarning), Localize("Saving settings to '%s' failed"), CONFIG_FILE);
|
||||
m_vWarnings.emplace_back(aWarning);
|
||||
}
|
||||
s_SavedConfig = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -496,19 +496,27 @@ bool CConfigManager::Save()
|
|||
WriteLine(pCommand);
|
||||
}
|
||||
|
||||
if(m_Failed)
|
||||
{
|
||||
log_error("config", "ERROR: writing to %s failed", aConfigFileTmp);
|
||||
}
|
||||
|
||||
if(io_sync(m_ConfigFile) != 0)
|
||||
{
|
||||
m_Failed = true;
|
||||
log_error("config", "ERROR: synchronizing %s failed", aConfigFileTmp);
|
||||
}
|
||||
|
||||
if(io_close(m_ConfigFile) != 0)
|
||||
{
|
||||
m_Failed = true;
|
||||
log_error("config", "ERROR: closing %s failed", aConfigFileTmp);
|
||||
}
|
||||
|
||||
m_ConfigFile = 0;
|
||||
|
||||
if(m_Failed)
|
||||
{
|
||||
log_error("config", "ERROR: writing to %s failed", aConfigFileTmp);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue