diff options
author | Jonathan Yap <jhwelch@gmail.com> | 2014-12-09 16:48:00 -0500 |
---|---|---|
committer | Jonathan Yap <jhwelch@gmail.com> | 2014-12-09 16:48:00 -0500 |
commit | 47282ceb7e8b8083cf816dd26bd4907aba313959 (patch) | |
tree | 9a74d988f638915049dd3b20593c2eb39c631db4 /indra/newview/llpresetsmanager.cpp | |
parent | 5be238b127ff30f09105ad6f0d9b8ee3dec8b40f (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.cpp | 18 |
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) |