From 57935506c29e4dfde82626a91a853d87a46aead3 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 25 Feb 2013 13:41:37 -0800 Subject: merge --- indra/newview/llconversationlog.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 4953bcbd02..03d1647c5e 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -380,13 +380,32 @@ void LLConversationLog::cache() bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory) { + + std::string backupFileName; + UINT backupFileCount = 0; + //Does the file exist in the current path if(LLFile::isfile(originDirectory)) { - //Does same file exist in the destination path, if so try to remove it + + //File already exists so make a backup file if(LLFile::isfile(targetDirectory)) { - LLFile::remove(targetDirectory); + backupFileName = targetDirectory + ".backup"; + + //If needed store backup file as .backup1 etc. + while(LLFile::isfile(backupFileName)) + { + backupFileName = targetDirectory + ".backup"; + + if(backupFileCount) + { + backupFileName += 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 -- cgit v1.2.3