diff options
| author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-09-21 01:07:56 +0200 | 
|---|---|---|
| committer | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-09-21 01:21:20 +0200 | 
| commit | dc57c88e7ff8043d4413573ad72869d51bdb1d0d (patch) | |
| tree | 409d96f4211fe3b876e3eb2e959d146e2cf16b0c | |
| parent | 51346ddbb0895815a288465b8751bc8b1c6c2d33 (diff) | |
SL-20287 The 'search_history.txt' file in the user profile is always empty
| -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()) | 
