Merge commit '11f41a4467e4d1daf64a4c72209c26f3e5a2d7ba' into puvvadar/gitflow_211118_o3de
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "EditorCommon.h"
|
||||
#include "CanvasHelpers.h"
|
||||
#include "AssetDropHelpers.h"
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/sort.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
@@ -697,15 +698,36 @@ bool EditorWindow::SaveCanvasToXml(UiCanvasMetadata& canvasMetadata, bool forceA
|
||||
else if (recentFiles.size() > 0)
|
||||
{
|
||||
dir = Path::GetPath(recentFiles.front());
|
||||
dir.append(canvasMetadata.m_canvasDisplayName.c_str());
|
||||
}
|
||||
// Else go to the default canvas directory
|
||||
else
|
||||
{
|
||||
dir = FileHelpers::GetAbsoluteDir(UICANVASEDITOR_CANVAS_DIRECTORY);
|
||||
dir.append(canvasMetadata.m_canvasDisplayName.c_str());
|
||||
}
|
||||
|
||||
// Make sure the directory exists. If not, walk up the directory path until we find one that does
|
||||
// so that we will have a consistent 'starting folder' in the 'AzQtComponents::FileDialog::GetSaveFileName' call
|
||||
// across different platforms.
|
||||
AZ::IO::FixedMaxPath dirPath(dir.toUtf8().constData());
|
||||
|
||||
while (!AZ::IO::SystemFile::IsDirectory(dirPath.c_str()))
|
||||
{
|
||||
AZ::IO::PathView parentPath = dirPath.ParentPath();
|
||||
if (parentPath == dirPath)
|
||||
{
|
||||
// We've reach the root path, need to break out whether or not
|
||||
// the root path exists
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
dirPath = parentPath;
|
||||
}
|
||||
}
|
||||
// Append the default filename
|
||||
dirPath /= canvasMetadata.m_canvasDisplayName;
|
||||
dir = QString::fromUtf8(dirPath.c_str(), static_cast<int>(dirPath.Native().size()));
|
||||
|
||||
QString filename = AzQtComponents::FileDialog::GetSaveFileName(nullptr,
|
||||
QString(),
|
||||
dir,
|
||||
|
||||
Reference in New Issue
Block a user