summaryrefslogtreecommitdiff
path: root/indra/newview/llpresetsmanager.cpp
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2014-12-09 16:48:00 -0500
committerJonathan Yap <jhwelch@gmail.com>2014-12-09 16:48:00 -0500
commit47282ceb7e8b8083cf816dd26bd4907aba313959 (patch)
tree9a74d988f638915049dd3b20593c2eb39c631db4 /indra/newview/llpresetsmanager.cpp
parent5be238b127ff30f09105ad6f0d9b8ee3dec8b40f (diff)
STORM-2082 Improve file error handling, add help topic labels to new floaters.
Diffstat (limited to 'indra/newview/llpresetsmanager.cpp')
-rw-r--r--indra/newview/llpresetsmanager.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index 260f2c9547..971a5ecf52 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -126,7 +126,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam
presets = mPresetNames;
}
-void LLPresetsManager::savePreset(const std::string& subdirectory, const std::string& name)
+bool LLPresetsManager::savePreset(const std::string& subdirectory, const std::string& name)
{
llassert(!name.empty());
@@ -203,12 +203,20 @@ void LLPresetsManager::savePreset(const std::string& subdirectory, const std::st
// write to file
llofstream presetsXML(pathName);
+ if (!presetsXML.is_open())
+ {
+ LL_WARNS("Presets") << "Cannot open for output preset file " << pathName << LL_ENDL;
+ return false;
+ }
+
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
// signal interested parties
mPresetListChangeSignal();
+
+ return true;
}
void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option)
@@ -241,10 +249,10 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st
{
std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml");
- gSavedSettings.loadFromFile(full_path, false, true);
-
- // signal interested parties
- mPresetListChangeSignal();
+ if(gSavedSettings.loadFromFile(full_path, false, true) > 0)
+ {
+ mPresetListChangeSignal();
+ }
}
bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std::string& name)