diff --git a/Code/Framework/AzCore/AzCore/IO/FileIOEventBus.h b/Code/Framework/AzCore/AzCore/IO/FileIOEventBus.h deleted file mode 100644 index fdfcc42012..0000000000 --- a/Code/Framework/AzCore/AzCore/IO/FileIOEventBus.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef AZCORE_SYSTEM_FILE_BUS_H -#define AZCORE_SYSTEM_FILE_BUS_H - -#include -#include -#include - -namespace AZ -{ - namespace IO - { - /** - * Interface for handling file io events. All events are syncronized - */ - class FileIOEvents - : public AZ::EBusTraits - { - public: - virtual ~FileIOEvents() {} - - ////////////////////////////////////////////////////////////////////////// - // EBusTraits overrides - //TODO rbbaklov or zolniery look into why a recursive lock was not needed previously - typedef AZStd::recursive_mutex MutexType; //< make sure all file events are thread safe as they will called from many threads - ////////////////////////////////////////////////////////////////////////// - - /** - * You will either have a file (SystemFile) pointer or fileName pointer to the file name. - * \param fileName is provided when there is NO SystemFile object (when you call static functions). - */ - virtual void OnError(const SystemFile* file, const char* fileName, int errorCode) = 0; - }; - - typedef AZ::EBus FileIOEventBus; - } -} -#endif // AZCORE_SYSTEM_FILE_BUS_H -#pragma once diff --git a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp index 49f5c64c20..12f4003144 100644 --- a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp +++ b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -101,7 +100,6 @@ bool SystemFile::Open(const char* fileName, int mode, int platformFlags) { if (strlen(fileName) > m_fileName.max_size()) { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, 0); return false; } diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 08fc4c28af..71a87234a9 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -151,7 +151,6 @@ set(FILES IO/CompressorZStd.h IO/FileIO.cpp IO/FileIO.h - IO/FileIOEventBus.h IO/FileReader.cpp IO/FileReader.h IO/IOUtils.h diff --git a/Code/Framework/AzCore/Platform/Android/AzCore/IO/SystemFile_Android.cpp b/Code/Framework/AzCore/Platform/Android/AzCore/IO/SystemFile_Android.cpp index b9a6cfef9a..4bd316e4d9 100644 --- a/Code/Framework/AzCore/Platform/Android/AzCore/IO/SystemFile_Android.cpp +++ b/Code/Framework/AzCore/Platform/Android/AzCore/IO/SystemFile_Android.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -87,7 +86,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags) } else { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, EINVAL); return false; } @@ -103,7 +101,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags) { if (isApkFile) { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, ENOSPC); return false; } @@ -125,7 +122,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags) if (m_handle == PlatformSpecificInvalidHandle) { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, errorCode); return false; } @@ -168,22 +164,8 @@ namespace Platform::Internal entry = readdir(dir); } - int lastError = errno; - if (lastError != 0) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, filter, lastError); - } - closedir(dir); } - else - { - int lastError = errno; - if (lastError != ENOENT) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, filter, 0); - } - } } void FindFilesInApk(const char* filter, const SystemFile::FindFileCB& cb) @@ -234,10 +216,6 @@ namespace Platform if (handle != PlatformSpecificInvalidHandle) { off_t result = fseeko(handle, static_cast(offset), mode); - if (result != 0) - { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); - } } } @@ -248,7 +226,6 @@ namespace Platform off_t result = ftello(handle); if (result == (off_t)-1) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); return 0; } return aznumeric_cast(result); @@ -292,7 +269,6 @@ namespace Platform if (bytesRead != bytesToRead && ferror(handle)) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); return 0; } @@ -311,7 +287,6 @@ namespace Platform if (bytesWritten != bytesToWrite && ferror(handle)) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); return 0; } @@ -325,10 +300,7 @@ namespace Platform { if (handle != PlatformSpecificInvalidHandle) { - if (fflush(handle) != 0) - { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); - } + fflush(handle); } } @@ -347,7 +319,6 @@ namespace Platform struct stat fileStat; if (stat(fileName, &fileStat) < 0) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, 0); return 0; } return static_cast(fileStat.st_size); diff --git a/Code/Framework/AzCore/Platform/Common/Apple/AzCore/IO/SystemFile_Apple.cpp b/Code/Framework/AzCore/Platform/Common/Apple/AzCore/IO/SystemFile_Apple.cpp index be5cbc3859..f814f16598 100644 --- a/Code/Framework/AzCore/Platform/Common/Apple/AzCore/IO/SystemFile_Apple.cpp +++ b/Code/Framework/AzCore/Platform/Common/Apple/AzCore/IO/SystemFile_Apple.cpp @@ -7,7 +7,6 @@ */ #include -#include #include #include #include @@ -44,21 +43,7 @@ namespace AZ::IO::Platform entry = readdir(dir); } - int lastError = errno; - if (lastError != 0) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, filter, lastError); - } - closedir(dir); } - else - { - int lastError = errno; - if (lastError != ENOENT) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, filter, 0); - } - } } } diff --git a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp index 8f651a9559..2bf7fdc5f2 100644 --- a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp +++ b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -130,7 +129,6 @@ namespace Platform int result = remove(fileName); if (result != 0) { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, fileName, result); return false; } @@ -142,7 +140,6 @@ namespace Platform int result = rename(sourceFileName, targetFileName); if (result) { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, sourceFileName, result); return false; } @@ -198,10 +195,6 @@ namespace Platform } azstrcpy(dirPath, AZ_MAX_PATH_LEN, dirName); bool success = CreateDirRecursive(dirPath); - if (!success) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, dirName, errno); - } return success; } return false; diff --git a/Code/Framework/AzCore/Platform/Common/UnixLikeDefault/AzCore/IO/SystemFile_UnixLikeDefault.cpp b/Code/Framework/AzCore/Platform/Common/UnixLikeDefault/AzCore/IO/SystemFile_UnixLikeDefault.cpp index 88c47ed142..7302232a49 100644 --- a/Code/Framework/AzCore/Platform/Common/UnixLikeDefault/AzCore/IO/SystemFile_UnixLikeDefault.cpp +++ b/Code/Framework/AzCore/Platform/Common/UnixLikeDefault/AzCore/IO/SystemFile_UnixLikeDefault.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -61,7 +60,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags) } else { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, 0); return false; } @@ -88,7 +86,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags) if (m_handle == PlatformSpecificInvalidHandle) { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, errno); return false; } else @@ -119,11 +116,7 @@ namespace Platform { if (handle != PlatformSpecificInvalidHandle) { - int result = lseek(handle, offset, mode); - if (result == -1) - { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); - } + lseek(handle, offset, mode); } } @@ -132,10 +125,6 @@ namespace Platform if (handle != PlatformSpecificInvalidHandle) { off_t result = lseek(handle, 0, SEEK_CUR); - if (result == (off_t)-1) - { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); - } return aznumeric_cast(result); } @@ -149,14 +138,12 @@ namespace Platform off_t current = lseek(handle, 0, SEEK_CUR); if (current == (off_t)-1) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, current); return false; } off_t end = lseek(handle, 0, SEEK_END); if (end == (off_t)-1) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, end); return false; } @@ -191,7 +178,6 @@ namespace Platform ssize_t bytesRead = read(handle, buffer, byteSize); if (bytesRead == -1) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); return 0; } return bytesRead; @@ -207,7 +193,6 @@ namespace Platform ssize_t result = write(handle, buffer, byteSize); if (result == -1) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); return 0; } return result; @@ -221,10 +206,7 @@ namespace Platform if (handle != PlatformSpecificInvalidHandle) { #if AZ_TRAIT_SYSTEMFILE_FSYNC_IS_DEFINED - if (fsync(handle) != 0) - { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, errno); - } + fsync(handle); #endif } } @@ -236,7 +218,6 @@ namespace Platform struct stat stat; if (fstat(handle, &stat) < 0) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, 0); return 0; } return stat.st_size; diff --git a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/SystemFile_WinAPI.cpp b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/SystemFile_WinAPI.cpp index 0fe32dcd4a..d608d67a85 100644 --- a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/SystemFile_WinAPI.cpp +++ b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/SystemFile_WinAPI.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -142,7 +141,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags) if (m_handle == INVALID_HANDLE_VALUE) { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, (int)GetLastError()); return false; } else @@ -160,10 +158,7 @@ void SystemFile::PlatformClose() { if (m_handle != PlatformSpecificInvalidHandle) { - if (!CloseHandle(m_handle)) - { - EBUS_EVENT(FileIOEventBus, OnError, this, nullptr, (int)GetLastError()); - } + CloseHandle(m_handle); m_handle = INVALID_HANDLE_VALUE; } } @@ -177,7 +172,7 @@ namespace Platform { using FileHandleType = AZ::IO::SystemFile::FileHandleType; - void Seek(FileHandleType handle, const SystemFile* systemFile, SystemFile::SeekSizeType offset, SystemFile::SeekMode mode) + void Seek(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile, SystemFile::SeekSizeType offset, SystemFile::SeekMode mode) { if (handle != PlatformSpecificInvalidHandle) { @@ -185,14 +180,11 @@ namespace Platform LARGE_INTEGER distToMove; distToMove.QuadPart = offset; - if (!SetFilePointerEx(handle, distToMove, 0, dwMoveMethod)) - { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); - } + SetFilePointerEx(handle, distToMove, 0, dwMoveMethod); } } - SystemFile::SizeType Tell(FileHandleType handle, const SystemFile* systemFile) + SystemFile::SizeType Tell(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile) { if (handle != PlatformSpecificInvalidHandle) { @@ -202,7 +194,6 @@ namespace Platform LARGE_INTEGER newFilePtr; if (!SetFilePointerEx(handle, distToMove, &newFilePtr, FILE_CURRENT)) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); return 0; } @@ -212,7 +203,7 @@ namespace Platform return 0; } - bool Eof(FileHandleType handle, const SystemFile* systemFile) + bool Eof(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile) { if (handle != PlatformSpecificInvalidHandle) { @@ -222,14 +213,12 @@ namespace Platform LARGE_INTEGER currentFilePtr; if (!SetFilePointerEx(handle, zero, ¤tFilePtr, FILE_CURRENT)) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); return false; } FILE_STANDARD_INFO fileInfo; if (!GetFileInformationByHandleEx(handle, FileStandardInfo, &fileInfo, sizeof(fileInfo))) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); return false; } @@ -239,14 +228,13 @@ namespace Platform return false; } - AZ::u64 ModificationTime(FileHandleType handle, const SystemFile* systemFile) + AZ::u64 ModificationTime(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile) { if (handle != PlatformSpecificInvalidHandle) { FILE_BASIC_INFO fileInfo; if (!GetFileInformationByHandleEx(handle, FileBasicInfo, &fileInfo, sizeof(fileInfo))) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); return 0; } @@ -263,7 +251,7 @@ namespace Platform return 0; } - SystemFile::SizeType Read(FileHandleType handle, const SystemFile* systemFile, SizeType byteSize, void* buffer) + SystemFile::SizeType Read(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile, SizeType byteSize, void* buffer) { if (handle != PlatformSpecificInvalidHandle) { @@ -271,7 +259,6 @@ namespace Platform DWORD nNumberOfBytesToRead = (DWORD)byteSize; if (!ReadFile(handle, buffer, nNumberOfBytesToRead, &dwNumBytesRead, 0)) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); return 0; } return static_cast(dwNumBytesRead); @@ -280,7 +267,7 @@ namespace Platform return 0; } - SystemFile::SizeType Write(FileHandleType handle, const SystemFile* systemFile, const void* buffer, SizeType byteSize) + SystemFile::SizeType Write(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile, const void* buffer, SizeType byteSize) { if (handle != PlatformSpecificInvalidHandle) { @@ -288,7 +275,6 @@ namespace Platform DWORD nNumberOfBytesToWrite = (DWORD)byteSize; if (!WriteFile(handle, buffer, nNumberOfBytesToWrite, &dwNumBytesWritten, 0)) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); return 0; } return static_cast(dwNumBytesWritten); @@ -297,25 +283,21 @@ namespace Platform return 0; } - void Flush(FileHandleType handle, const SystemFile* systemFile) + void Flush(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile) { if (handle != PlatformSpecificInvalidHandle) { - if (!FlushFileBuffers(handle)) - { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); - } + FlushFileBuffers(handle); } } - SystemFile::SizeType Length(FileHandleType handle, const SystemFile* systemFile) + SystemFile::SizeType Length(FileHandleType handle, [[maybe_unused]] const SystemFile* systemFile) { if (handle != PlatformSpecificInvalidHandle) { LARGE_INTEGER size; if (!GetFileSizeEx(handle, &size)) { - EBUS_EVENT(FileIOEventBus, OnError, systemFile, nullptr, (int)GetLastError()); return 0; } @@ -341,7 +323,6 @@ namespace Platform { WIN32_FIND_DATA fd; HANDLE hFile; - int lastError; AZ::IO::FixedMaxPathWString filterW; AZStd::to_wstring(filterW, filter); @@ -367,20 +348,7 @@ namespace Platform cb(fileName, (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0); } - lastError = (int)GetLastError(); FindClose(hFile); - if (lastError != ERROR_NO_MORE_FILES) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, fileName, lastError); - } - } - else - { - lastError = (int)GetLastError(); - if (lastError != ERROR_FILE_NOT_FOUND) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, filter, lastError); - } } } @@ -394,15 +362,11 @@ namespace Platform if (handle == INVALID_HANDLE_VALUE) { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, fileName, (int)GetLastError()); return 0; } FILE_BASIC_INFO fileInfo{}; - if (!GetFileInformationByHandleEx(handle, FileBasicInfo, &fileInfo, sizeof(fileInfo))) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, fileName, (int)GetLastError()); - } + GetFileInformationByHandleEx(handle, FileBasicInfo, &fileInfo, sizeof(fileInfo)); CloseHandle(handle); @@ -434,10 +398,6 @@ namespace Platform fileSize.HighPart = data.nFileSizeHigh; len = aznumeric_cast(fileSize.QuadPart); } - else - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, fileName, (int)GetLastError()); - } return len; } @@ -448,7 +408,6 @@ namespace Platform AZStd::to_wstring(fileNameW, fileName); if (DeleteFileW(fileNameW.c_str()) == 0) { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, fileName, (int)GetLastError()); return false; } @@ -463,7 +422,6 @@ namespace Platform AZStd::to_wstring(targetFileNameW, targetFileName); if (MoveFileExW(sourceFileNameW.c_str(), targetFileNameW.c_str(), overwrite ? MOVEFILE_REPLACE_EXISTING : 0) == 0) { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, sourceFileName, (int)GetLastError()); return false; } @@ -503,10 +461,6 @@ namespace Platform AZ::IO::FixedMaxPathWString dirNameW; AZStd::to_wstring(dirNameW, dirName); bool success = CreateDirRecursive(dirNameW); - if (!success) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, dirName, (int)GetLastError()); - } return success; } return false; diff --git a/Code/Framework/AzCore/Platform/Linux/AzCore/IO/SystemFile_Linux.cpp b/Code/Framework/AzCore/Platform/Linux/AzCore/IO/SystemFile_Linux.cpp index be5cbc3859..f814f16598 100644 --- a/Code/Framework/AzCore/Platform/Linux/AzCore/IO/SystemFile_Linux.cpp +++ b/Code/Framework/AzCore/Platform/Linux/AzCore/IO/SystemFile_Linux.cpp @@ -7,7 +7,6 @@ */ #include -#include #include #include #include @@ -44,21 +43,7 @@ namespace AZ::IO::Platform entry = readdir(dir); } - int lastError = errno; - if (lastError != 0) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, filter, lastError); - } - closedir(dir); } - else - { - int lastError = errno; - if (lastError != ENOENT) - { - EBUS_EVENT(FileIOEventBus, OnError, nullptr, filter, 0); - } - } } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.cpp index ac8e034faf..6647f48c31 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.cpp @@ -409,9 +409,6 @@ namespace AzToolsFramework return false; } - // Surface any errors during the renames - ScopedIOEventBusHandler renameHandler; - // Rename all the temp files to the actual bundle names for (int idx = 0; idx < bundlePathDeltaCatalogPair.size(); ++idx) { @@ -759,20 +756,5 @@ namespace AzToolsFramework } return true; } - - ScopedIOEventBusHandler::ScopedIOEventBusHandler() - { - BusConnect(); - } - - ScopedIOEventBusHandler::~ScopedIOEventBusHandler() - { - BusDisconnect(); - } - - void ScopedIOEventBusHandler::OnError([[maybe_unused]] const AZ::IO::SystemFile* file, [[maybe_unused]] const char* fileName, [[maybe_unused]] int errorCode) - { - AZ_Error("AssetBundleComponent", false, "FileIO Error for file %s (errorCode %d)", file && file->Name() ? file->Name() : fileName, errorCode); - } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.h index a2f7729e4e..8d2b0f4263 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBundle/AssetBundleComponent.h @@ -8,7 +8,6 @@ #pragma once #include -#include #include namespace AZ @@ -92,14 +91,4 @@ namespace AzToolsFramework //! We only create the delta catalog once we are sure about what all the files that will go in it. bool AddCatalogAndFilesToBundle(const AZStd::vector& deltaCatalogEntries, const AZStd::vector& fileEntries, const AZStd::string& bundleFilePath, const char* assetAlias, const AzFramework::PlatformId& platformId); }; - - class ScopedIOEventBusHandler : - public AZ::IO::FileIOEventBus::Handler - { - public: - ScopedIOEventBusHandler(); - ~ScopedIOEventBusHandler(); - - void OnError(const AZ::IO::SystemFile* file, const char* fileName, int errorCode) override; - }; } diff --git a/Code/Tools/AssetProcessor/native/tests/AssetProcessorTest.cpp b/Code/Tools/AssetProcessor/native/tests/AssetProcessorTest.cpp index 2629f7b956..5be9436145 100644 --- a/Code/Tools/AssetProcessor/native/tests/AssetProcessorTest.cpp +++ b/Code/Tools/AssetProcessor/native/tests/AssetProcessorTest.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include "BaseAssetProcessorTest.h" @@ -55,13 +54,11 @@ namespace AssetProcessor }; class LegacyTestAdapter : public AssetProcessorTest, - public ::testing::WithParamInterface, - public AZ::IO::FileIOEventBus::Handler + public ::testing::WithParamInterface { void SetUp() override { AssetProcessorTest::SetUp(); - AZ::IO::FileIOEventBus::Handler::BusConnect(); static int numParams = 1; static char processName[] = {"AssetProcessorBatch"}; @@ -91,18 +88,9 @@ namespace AssetProcessor void TearDown() override { m_application.reset(); - AZ::IO::FileIOEventBus::Handler::BusDisconnect(); AssetProcessorTest::TearDown(); } - void OnError( - [[maybe_unused]] const AZ::IO::SystemFile* file, - [[maybe_unused]] const char* fileName, - [[maybe_unused]] int errorCode) override - { - AZ_Error("LegacyTestAdapter", false, "File error detected with %s with code %d", fileName, errorCode); - } - AZStd::unique_ptr m_application; }; diff --git a/Gems/ScriptCanvas/Code/Editor/Framework/ScriptCanvasGraphUtilities.inl b/Gems/ScriptCanvas/Code/Editor/Framework/ScriptCanvasGraphUtilities.inl index 05541196f7..f8da519be0 100644 --- a/Gems/ScriptCanvas/Code/Editor/Framework/ScriptCanvasGraphUtilities.inl +++ b/Gems/ScriptCanvas/Code/Editor/Framework/ScriptCanvasGraphUtilities.inl @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/Controller.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/Controller.cpp index dbcd176ee5..6209667910 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/Controller.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/Controller.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/FileSaver.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/FileSaver.cpp index f067feeca4..a2af9c580c 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/FileSaver.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/FileSaver.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -16,37 +15,6 @@ #include #include -namespace FileSaverCpp -{ - class FileEventHandler - : public AZ::IO::FileIOEventBus::Handler - { - public: - int m_errorCode = 0; - AZStd::string m_fileName; - - FileEventHandler() - { - BusConnect(); - } - - ~FileEventHandler() - { - BusDisconnect(); - } - - void OnError(const AZ::IO::SystemFile* /*file*/, const char* fileName, int errorCode) override - { - m_errorCode = errorCode; - - if (fileName) - { - m_fileName = fileName; - } - } - }; -} - namespace ScriptCanvasEditor { namespace VersionExplorer @@ -63,8 +31,6 @@ namespace ScriptCanvasEditor , AZStd::string target , size_t remainingAttempts) { - FileSaverCpp::FileEventHandler fileEventHandler; - if (remainingAttempts == 0) { AZ::SystemTickBus::QueueFunction([this, tmpFileName]() diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp index a9ca526373..bbf3a77c55 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp @@ -9,7 +9,6 @@ #include "TranslationUtilities.h" #include -#include #include #include #include @@ -71,34 +70,6 @@ namespace TranslationUtilitiesCPP return AZStd::string::format("%s%s_VM.%s", TranslationUtilitiesCPP::k_fileDirectoryPathLua, source.m_name.data(), extension.data()); } - class FileEventHandler - : public AZ::IO::FileIOEventBus::Handler - { - public: - int m_errorCode = 0; - AZStd::string m_fileName; - - FileEventHandler() - { - BusConnect(); - } - - ~FileEventHandler() - { - BusDisconnect(); - } - - void OnError(const AZ::IO::SystemFile* /*file*/, const char* fileName, int errorCode) override - { - m_errorCode = errorCode; - - if (fileName) - { - m_fileName = fileName; - } - } - }; - AZ::Outcome SaveFile(const Grammar::Source& source, AZStd::string_view text, AZStd::string_view extension) { AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance(); @@ -111,25 +82,23 @@ namespace TranslationUtilitiesCPP // \todo get a (debug) file path based on the extension const AZStd::string filePath = TranslationUtilitiesCPP::GetDebugLuaFilePath(source, extension); - FileEventHandler eventHandler; - AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle; const AZ::IO::Result fileOpenResult = fileIO->Open(filePath.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText, fileHandle); if (fileOpenResult != AZ::IO::ResultCode::Success) { - return AZ::Failure(AZStd::string::format("Failed to open file: %s, error code: %d", filePath.c_str(), eventHandler.m_errorCode)); + return AZ::Failure(AZStd::string::format("Failed to open file: %sd", filePath.c_str())); } const AZ::IO::Result fileWriteResult = fileIO->Write(fileHandle, text.begin(), text.size()); if (fileWriteResult != AZ::IO::ResultCode::Success) { - return AZ::Failure(AZStd::string::format("Failed to write file: %s, error code: %d", filePath.c_str(), eventHandler.m_errorCode)); + return AZ::Failure(AZStd::string::format("Failed to write file: %s", filePath.c_str())); } const AZ::IO::Result fileCloseResult = fileIO->Close(fileHandle); if (fileCloseResult != AZ::IO::ResultCode::Success) { - return AZ::Failure(AZStd::string::format("Failed to close file: %s, error code: %d", filePath.c_str(), eventHandler.m_errorCode)); + return AZ::Failure(AZStd::string::format("Failed to close file: %s", filePath.c_str())); } return AZ::Success(); diff --git a/Gems/ScriptCanvasTesting/Code/Source/Framework/ScriptCanvasTestUtilities.cpp b/Gems/ScriptCanvasTesting/Code/Source/Framework/ScriptCanvasTestUtilities.cpp index f69412358f..f4abbea7b2 100644 --- a/Gems/ScriptCanvasTesting/Code/Source/Framework/ScriptCanvasTestUtilities.cpp +++ b/Gems/ScriptCanvasTesting/Code/Source/Framework/ScriptCanvasTestUtilities.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include