diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-02-25 13:41:37 -0800 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-02-25 13:41:37 -0800 |
commit | 57935506c29e4dfde82626a91a853d87a46aead3 (patch) | |
tree | 4e1f987c553d6af2ba9f91fe3ba0b7e36fcb18a9 /indra/newview | |
parent | e5d6b29260159f402391be393d046721dfeacbc9 (diff) |
merge
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llconversationlog.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
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 |