summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2010-12-13 13:38:46 +0200
committerVadim ProductEngine <vsavchuk@productengine.com>2010-12-13 13:38:46 +0200
commit37cd8ad2a27188538c29fdcce58cf8ec6185231c (patch)
treec7639997147a642885b7b917bca651ecfb8fbf1f /indra/newview/llpreviewscript.cpp
parente27bcbe0d20c87556b0bcb1e3feaaea6544d3e16 (diff)
STORM-781 FIXED Added support for editing multiple scripts within inventory of the same object using external editor.
The bug was caused by using the object ID as temporary file name for editing script, which of course didn't work for multiple scripts in the same object inventory. The fix is to use MD5("object id" + "script inventory item id") for the file name.
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r--indra/newview/llpreviewscript.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 330e809c53..d0ebf047e8 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -2034,7 +2034,17 @@ bool LLLiveLSLEditor::writeToFile(const std::string& filename)
std::string LLLiveLSLEditor::getTmpFileName()
{
- return std::string(LLFile::tmpdir()) + "sl_script_" + mObjectUUID.asString() + ".lsl";
+ // Take script inventory item id (within the object inventory)
+ // to consideration so that it's possible to edit multiple scripts
+ // in the same object inventory simultaneously (STORM-781).
+ std::string script_id = mObjectUUID.asString() + "_" + mItemUUID.asString();
+
+ // Use MD5 sum to make the file name shorter and not exceed maximum path length.
+ char script_id_hash_str[33]; /* Flawfinder: ignore */
+ LLMD5 script_id_hash((const U8 *)script_id.c_str());
+ script_id_hash.hex_digest(script_id_hash_str);
+
+ return std::string(LLFile::tmpdir()) + "sl_script_" + script_id_hash_str + ".lsl";
}
void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url,