summaryrefslogtreecommitdiff
path: root/indra/llfilesystem/llfilesystem.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2020-10-27 16:46:31 +0200
committerMnikolenko Productengine <mnikolenko@productengine.com>2020-10-27 16:46:31 +0200
commit3b4bd86a1de3fb1a9065024089fcfec2dae1da85 (patch)
tree66395f19c9917206c6552f52159896ea65708666 /indra/llfilesystem/llfilesystem.cpp
parent1c94c929ea99f79b87b58097348e0364512da9ad (diff)
SL-14182 remove old script asset file after saving changes and allow renaming files if destination file exists
Diffstat (limited to 'indra/llfilesystem/llfilesystem.cpp')
-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;