logic: handled case when selected project location can not be written (issue #735) (#906)

This commit is contained in:
Malte Langkabel
2020-02-04 20:24:59 +01:00
committed by GitHub
parent 7556d171cb
commit 7f9f098c70
5 changed files with 31 additions and 13 deletions
+10 -6
View File
@@ -50,28 +50,32 @@ bool Settings::loadFromString(const std::string& text, bool readOnly)
return true;
}
void Settings::save()
bool Settings::save()
{
if (m_readOnly)
{
return;
return false;
}
bool success = false;
if (m_config.get() && !m_filePath.empty())
{
m_config->save(m_filePath.str());
success = m_config->save(m_filePath.str());
}
else
if (!success)
{
LOG_WARNING(L"Settings were not saved: " + m_filePath.wstr());
}
return success;
}
void Settings::save(const FilePath& filePath)
bool Settings::save(const FilePath& filePath)
{
setFilePath(filePath);
save();
return save();
}
void Settings::clear()
+2 -2
View File
@@ -19,8 +19,8 @@ public:
bool load(const FilePath& filePath, bool readOnly = false);
bool loadFromString(const std::string& text, bool readOnly = false);
void save();
void save(const FilePath& filePath);
bool save();
bool save(const FilePath& filePath);
void clear();
+2 -2
View File
@@ -375,10 +375,10 @@ bool ConfigManager::load(const std::shared_ptr<TextAccess> textAccess)
return true;
}
void ConfigManager::save(const std::string filepath)
bool ConfigManager::save(const std::string filepath)
{
std::string output("");
createXmlDocument(true, filepath, output);
return createXmlDocument(true, filepath, output);
}
void ConfigManager::setWarnOnEmptyKey(bool warnOnEmptyKey) const
+1 -1
View File
@@ -59,7 +59,7 @@ public:
std::vector<std::string> getSublevelKeys(const std::string& key) const;
bool load(const std::shared_ptr<TextAccess> textAccess);
void save(const std::string filepath);
bool save(const std::string filepath);
std::string toString();
void setWarnOnEmptyKey(bool warnOnEmptyKey) const;