summaryrefslogtreecommitdiff
path: root/indra/llfilesystem
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2020-10-27 15:19:44 +0000
committerCallum Linden <callum@lindenlab.com>2020-10-27 15:19:44 +0000
commit581cb0a0e9c3191295e8ff5bfa836b40fd85f0b8 (patch)
tree66395f19c9917206c6552f52159896ea65708666 /indra/llfilesystem
parent1c94c929ea99f79b87b58097348e0364512da9ad (diff)
parent3b4bd86a1de3fb1a9065024089fcfec2dae1da85 (diff)
Merged in DRTVWR-519 (pull request #359)
SL-14182 remove old script asset file after saving changes and allow renaming files if destination file exists Approved-by: Callum Linden
Diffstat (limited to 'indra/llfilesystem')
-rw-r--r--indra/llfilesystem/llfilesystem.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp
index c6b20caa69..932ef2a9c6 100644
--- a/indra/llfilesystem/llfilesystem.cpp
+++ b/indra/llfilesystem/llfilesystem.cpp
@@ -99,12 +99,16 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp
new_file_id.toString(new_id_str);
const std::string new_filename = LLDiskCache::getInstance()->metaDataToFilepath(new_id_str, new_file_type, extra_info);
+ // Rename needs the new file to not exist.
+ LLFileSystem::removeFile(new_file_id, new_file_type);
+
if (std::rename(old_filename.c_str(), new_filename.c_str()))
{
// We would like to return FALSE here indicating the operation
// failed but the original code does not and doing so seems to
// break a lot of things so we go with the flow...
//return FALSE;
+ LL_WARNS() << "Failed to rename " << old_file_id << " to " << new_id_str << " reason: " << strerror(errno) << LL_ENDL;
}
return TRUE;