diff options
| author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-02-25 16:48:09 -0800 |
|---|---|---|
| committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-02-25 16:48:09 -0800 |
| commit | 084ea74d43471eec1ae8781c4946fcf2a3a76a78 (patch) | |
| tree | 4dd95e9f250b058307bbe9eec9f156e912b489b1 /indra/newview/llconversationlog.cpp | |
| parent | 57935506c29e4dfde82626a91a853d87a46aead3 (diff) | |
CHUI-778: Now when conversation log and trascript files are moved they will not overwrite prior files with the same name. Instead the prior files will be stored as *.backup.
Diffstat (limited to 'indra/newview/llconversationlog.cpp')
| -rw-r--r-- | indra/newview/llconversationlog.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 03d1647c5e..4be169e267 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -31,6 +31,8 @@ #include "llnotificationsutil.h" #include "lltrans.h" +#include "boost/lexical_cast.hpp" + const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec struct ConversationParams @@ -382,13 +384,12 @@ bool LLConversationLog::moveLog(const std::string &originDirectory, const std::s { std::string backupFileName; - UINT backupFileCount = 0; + unsigned backupFileCount = 0; - //Does the file exist in the current path - if(LLFile::isfile(originDirectory)) + //Does the file exist in the current path, if it does lets move it + if(LLFile::isfile(originDirectory)) { - - //File already exists so make a backup file + //The target directory contains that file already, so lets store it if(LLFile::isfile(targetDirectory)) { backupFileName = targetDirectory + ".backup"; @@ -396,19 +397,15 @@ bool LLConversationLog::moveLog(const std::string &originDirectory, const std::s //If needed store backup file as .backup1 etc. while(LLFile::isfile(backupFileName)) { - backupFileName = targetDirectory + ".backup"; - - if(backupFileCount) - { - backupFileName += backupFileCount; - } + ++backupFileCount; + backupFileName = targetDirectory + ".backup" + boost::lexical_cast<std::string>(backupFileCount); } //Rename the file to its backup name so it is not overwritten LLFile::rename(targetDirectory, backupFileName); } - //Move the file from the current path to destination path + //Move the file from the current path to target path if(LLFile::rename(originDirectory, targetDirectory) != 0) { return false; |
