diff options
author | Brett Joseph <bjoseph@vivox.com> | 2015-05-11 09:52:18 -0400 |
---|---|---|
committer | Brett Joseph <bjoseph@vivox.com> | 2015-05-11 09:52:18 -0400 |
commit | 43b7fe66db159faaa84d545f97818e7a6f0f6920 (patch) | |
tree | 6581ed36e716f6aa57b01f2861d6812294fb2261 /indra/newview/llurlhistory.cpp | |
parent | 7cc3e9b3cf8d70fce2ba0d4a398824e599fc8c5d (diff) | |
parent | e611e35e033e99f619b0e4938f6879c8e387efd5 (diff) |
Merged lindenlab/viewer-tools-update into default
Diffstat (limited to 'indra/newview/llurlhistory.cpp')
-rwxr-xr-x | indra/newview/llurlhistory.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp index 8eea2b242a..f7064e152a 100755 --- a/indra/newview/llurlhistory.cpp +++ b/indra/newview/llurlhistory.cpp @@ -40,29 +40,32 @@ const int MAX_URL_COUNT = 10; // static bool LLURLHistory::loadFile(const std::string& filename) { + bool dataloaded = false; + sHistorySD = LLSD(); LLSD data; - { - std::string temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); - - llifstream file((temp_str + filename)); - - if (file.is_open()) - { - LL_INFOS() << "Loading history.xml file at " << filename << LL_ENDL; - LLSDSerialize::fromXML(data, file); - } - - if (data.isUndefined()) - { - LL_INFOS() << "file missing, ill-formed, " - "or simply undefined; not changing the" - " file" << LL_ENDL; - sHistorySD = LLSD(); - return false; - } - } - sHistorySD = data; - return true; + + std::string user_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename); + + llifstream file(user_filename.c_str()); + if (file.is_open()) + { + LLSDSerialize::fromXML(data, file); + if (data.isUndefined()) + { + LL_WARNS() << "error loading " << user_filename << LL_ENDL; + } + else + { + LL_INFOS() << "Loaded history file at " << user_filename << LL_ENDL; + sHistorySD = data; + dataloaded = true; + } + } + else + { + LL_INFOS() << "Unable to open history file at " << user_filename << LL_ENDL; + } + return dataloaded; } // static @@ -76,10 +79,10 @@ bool LLURLHistory::saveFile(const std::string& filename) } temp_str += gDirUtilp->getDirDelimiter() + filename; - llofstream out(temp_str); + llofstream out(temp_str.c_str()); if (!out.good()) { - LL_WARNS() << "Unable to open " << filename << " for output." << LL_ENDL; + LL_WARNS() << "Unable to open " << temp_str << " for output." << LL_ENDL; return false; } |