From 98ecef2fd23650885fc1a36b6cdaf88939b03a10 Mon Sep 17 00:00:00 2001 From: chcurran <82187351+carlitosan@users.noreply.github.com> Date: Mon, 8 Nov 2021 14:39:20 -0800 Subject: [PATCH] source file save-as Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com> --- .../Code/Editor/View/Windows/MainWindow.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp index deb75ff78c..b20fcb7e7a 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp @@ -1764,7 +1764,7 @@ namespace ScriptCanvasEditor AZStd::string suggestedFilename; AZStd::string suggestedFileFilter; bool isValidFileName = false; - + if (save == Save::InPlace) { isValidFileName = true; @@ -1773,7 +1773,17 @@ namespace ScriptCanvasEditor } else { - GetSuggestedFullFilenameToSaveAs(inMemoryAssetId, suggestedFilename, suggestedFileFilter); + // replaces GetSuggestedFullFilenameToSaveAs + suggestedFileFilter = ScriptCanvasAssetDescription().GetExtensionImpl(); + + if (inMemoryAssetId.Path().empty()) + { + suggestedFilename = ScriptCanvasAssetDescription().GetSuggestedSavePathImpl(); + } + else + { + suggestedFilename = inMemoryAssetId.Path(); + } } EnsureSaveDestinationDirectory(suggestedFilename); @@ -1788,7 +1798,14 @@ namespace ScriptCanvasEditor // So we want to break out. if (!selectedFile.isEmpty()) { + ScriptCanvasAssetDescription assetDescription; AZStd::string filePath = selectedFile.toUtf8().data(); + + if (!AZ::StringFunc::EndsWith(filePath, assetDescription.GetExtensionImpl(), false)) + { + filePath += assetDescription.GetExtensionImpl(); + } + AZStd::string fileName; // Verify that the path is within the project