diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-09-21 01:07:56 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-09-21 01:19:31 +0200 |
commit | d72b43f1a90d271ac6d0b0a398a6f906afb3468c (patch) | |
tree | eadde37d61227636f4369da2b0c99d85b130e735 /indra/newview/llsearchhistory.cpp | |
parent | e3096da94bd0a9223d6936c5f2ba011b1922298d (diff) |
SL-20287 The 'search_history.txt' file in the user profile is always empty
Diffstat (limited to 'indra/newview/llsearchhistory.cpp')
-rw-r--r-- | indra/newview/llsearchhistory.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/indra/newview/llsearchhistory.cpp b/indra/newview/llsearchhistory.cpp index 449e0080f0..66e377cb8d 100644 --- a/indra/newview/llsearchhistory.cpp +++ b/indra/newview/llsearchhistory.cpp @@ -75,6 +75,17 @@ bool LLSearchHistory::save() { // build filename for each user std::string resolved_filename = getHistoryFilePath(); + + // delete the file if it is empty or contains only empty entries + if (std::find_if(mSearchHistory.begin(), mSearchHistory.end(), [](const LLSearchHistoryItem& x) + { + return !x.search_query.empty(); + }) == mSearchHistory.end()) + { + remove(resolved_filename.c_str()); + return true; + } + // open a file for writing llofstream file(resolved_filename.c_str()); if (!file.is_open()) |