fixed version explorer issue

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-11-17 12:17:45 -08:00
committed by Chris Burel
parent 4484b69036
commit f8fdf4b306
6 changed files with 19 additions and 14 deletions
@@ -1409,7 +1409,7 @@ namespace ScriptCanvasEditor
AZ::Outcome<ScriptCanvasEditor::SourceHandle, AZStd::string> outcome = LoadFromFile(fullPath);
if (!outcome.IsSuccess())
{
QMessageBox::warning(this, "Invalid Source File", QString("'%1' is not a valid file path.").arg(fullPath), QMessageBox::Ok);
QMessageBox::warning(this, "Invalid Source File", QString("'%1' failed to load properly.").arg(fullPath), QMessageBox::Ok);
m_errorFilePath = fullPath;
AZ_Warning("ScriptCanvas", false, "Unable to open file as a ScriptCanvas graph: %s", fullPath);
return;
@@ -165,7 +165,7 @@ namespace ScriptCanvasEditor
{
int result = QMessageBox::No;
QMessageBox mb
(QMessageBox::Warning
( QMessageBox::Warning
, QObject::tr("Failed to Save Upgraded File")
, QObject::tr("The upgraded file could not be saved because the file is read only.\n"
"Do you want to make it writeable and overwrite it?")
@@ -221,10 +221,16 @@ namespace ScriptCanvasEditor
{
auto streamer = AZ::Interface<AZ::IO::IStreamer>::Get();
AZ::IO::FileRequestPtr flushRequest = streamer->FlushCache(source.Path().c_str());
streamer->SetRequestCompleteCallback(flushRequest, [this, source]([[maybe_unused]] AZ::IO::FileRequestHandle request)
streamer->SetRequestCompleteCallback(flushRequest, [this]([[maybe_unused]] AZ::IO::FileRequestHandle request)
{
this->OnSourceFileReleased(source);
AZStd::lock_guard<AZStd::mutex> lock(m_mutex);
if (!m_sourceFileReleased)
{
m_sourceFileReleased = true;
AZ::SystemTickBus::QueueFunction([this]() { this->OnSourceFileReleased(m_source); });
}
});
streamer->QueueRequest(flushRequest);
}
}
@@ -33,6 +33,9 @@ namespace ScriptCanvasEditor
void Save(const SourceHandle& source);
private:
AZStd::mutex m_mutex;
bool m_sourceFileReleased = false;
SourceHandle m_source;
AZStd::function<void(const FileSaveResult& result)> m_onComplete;
AZStd::function<bool()> m_onReadOnlyFile;