diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-04-30 03:04:06 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-04-30 03:04:06 +0300 |
commit | e00edbeb4a7edfe4f190ac7bf2197aa8240e50c6 (patch) | |
tree | 25db350e573224fc2900c1e760f7cf429c599abe /indra/newview/lllogchat.cpp | |
parent | 3ad10e3075840b442f3a8f4593b4b4f10bad48e0 (diff) | |
parent | ce65bc2f13409d75dbc6502c970030cc5ed2e5ad (diff) |
Merge branch 'master' into DRTVWR-522-maint
# Conflicts:
# doc/contributions.txt
Diffstat (limited to 'indra/newview/lllogchat.cpp')
-rw-r--r-- | indra/newview/lllogchat.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 0ddcac44c9..fb9885b454 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -281,6 +281,28 @@ std::string LLLogChat::makeLogFileName(std::string filename) return filename; } +//static +void LLLogChat::renameLogFile(const std::string& old_filename, const std::string& new_filename) +{ + std::string new_name = cleanFileName(new_filename); + std::string old_name = cleanFileName(old_filename); + new_name = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, new_name); + old_name = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, old_name); + + if (new_name.empty() || old_name.empty()) + { + return; + } + + new_name += '.' + LL_TRANSCRIPT_FILE_EXTENSION; + old_name += '.' + LL_TRANSCRIPT_FILE_EXTENSION; + + if (!LLFile::isfile(new_name) && LLFile::isfile(old_name)) + { + LLFile::rename(old_name, new_name); + } +} + std::string LLLogChat::cleanFileName(std::string filename) { std::string invalidChars = "\"\'\\/?*:.<>|[]{}~"; // Cannot match glob or illegal filename chars |