Ver Fonte

[LYN-8041] Enable relocation of the Project Game Release Layout (#5380)

* Enable relocation of the Project Game Release Layout

Relocating the Project Game Release Layout to another directory on the file system failed due to the querying of the engine root failing due to the ComponentApplication::m_engineRoot not using the project path stored in the SettingsRegisry if the engine root cannot be detected

Removed the ApplicationRequestBus GetEngineRoot function.
The ComponentApplicationRequestBus has a function of the same name that returns the same path.

Removed the deprecated GetAppRoot function.
The path it returns has no defined value. It was not the engine root or the project root.
Removed unused CFileUtil and CFileUtil_impl functions that were invoking the ApplicationREquestBus GetEngineRoot function.
On the way to update the functions it was discovered that they aren't called

Added a CalculateBranchToken overload that can populate a fixed_string to avoid heap allocations

Signed-off-by: lumberyard-employee-dm <[email protected]>

* Protect against an empty list of artifacts to remove when generating the
engine.pak

Signed-off-by: lumberyard-employee-dm <[email protected]>
lumberyard-employee-dm há 3 anos atrás
pai
commit
5fc4551ac0
58 ficheiros alterados com 168 adições e 477 exclusões
  1. 3 4
      Code/Editor/CryEdit.cpp
  2. 0 2
      Code/Editor/Include/IFileUtil.h
  3. 2 138
      Code/Editor/Util/FileUtil.cpp
  4. 0 5
      Code/Editor/Util/FileUtil.h
  5. 0 10
      Code/Editor/Util/FileUtil_impl.cpp
  6. 0 2
      Code/Editor/Util/FileUtil_impl.h
  7. 2 4
      Code/Editor/Util/PathUtil.cpp
  8. 0 5
      Code/Editor/WelcomeScreen/WelcomeScreenDialog.cpp
  9. 20 32
      Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp
  10. 2 17
      Code/Framework/AzCore/AzCore/Component/ComponentApplication.h
  11. 0 4
      Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h
  12. 3 1
      Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp
  13. 27 17
      Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp
  14. 3 2
      Code/Framework/AzCore/AzCore/StringFunc/StringFunc.h
  15. 0 1
      Code/Framework/AzCore/AzCore/UnitTest/MockComponentApplication.h
  16. 0 1
      Code/Framework/AzCore/Tests/BehaviorContextFixture.h
  17. 7 13
      Code/Framework/AzCore/Tests/Components.cpp
  18. 0 1
      Code/Framework/AzCore/Tests/Serialization.cpp
  19. 0 6
      Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h
  20. 3 39
      Code/Framework/AzFramework/AzFramework/Application/Application.cpp
  21. 1 11
      Code/Framework/AzFramework/AzFramework/Application/Application.h
  22. 8 12
      Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp
  23. 1 1
      Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.h
  24. 4 6
      Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Thumbnails/SourceThumbnail.cpp
  25. 9 9
      Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/SourceControlThumbnail.cpp
  26. 0 1
      Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp
  27. 0 5
      Code/Framework/AzToolsFramework/Tests/UI/EntityPropertyEditorTests.cpp
  28. 1 3
      Code/Tools/AssetBundler/source/utils/GUIApplicationManager.cpp
  29. 0 1
      Code/Tools/AssetBundler/source/utils/applicationManager.cpp
  30. 1 2
      Code/Tools/AssetBundler/source/utils/utils.cpp
  31. 0 1
      Code/Tools/AssetBundler/source/utils/utils.h
  32. 8 8
      Code/Tools/AssetBundler/tests/UtilsTests.cpp
  33. 6 5
      Code/Tools/AssetBundler/tests/applicationManagerTests.cpp
  34. 24 12
      Code/Tools/AssetProcessor/native/tests/platformconfiguration/platformconfigurationtests.cpp
  35. 1 1
      Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp
  36. 0 1
      Code/Tools/PythonBindingsExample/source/Application.cpp
  37. 0 1
      Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp
  38. 3 5
      Code/Tools/SerializeContextTools/Converter.cpp
  39. 1 1
      Code/Tools/SerializeContextTools/Converter.h
  40. 0 1
      Gems/AWSClientAuth/Code/Tests/AWSClientAuthGemMock.h
  41. 6 15
      Gems/AssetValidation/Code/Source/AssetValidationSystemComponent.cpp
  42. 2 7
      Gems/AssetValidation/Code/Tests/AssetValidationTestShared.h
  43. 0 1
      Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp
  44. 4 5
      Gems/Atom/Feature/Common/Code/Source/LuxCore/LuxCoreRenderer.cpp
  45. 0 1
      Gems/Atom/RPI/Code/Tests.Builders/BuilderTestFixture.h
  46. 0 1
      Gems/Atom/RPI/Code/Tests/Common/AssetManagerTestFixture.h
  47. 5 22
      Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/Util.cpp
  48. 4 5
      Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiPassTree.inl
  49. 0 6
      Gems/AudioSystem/Code/Source/Editor/ImplementationManager.cpp
  50. 2 3
      Gems/EditorPythonBindings/Code/Source/PythonSystemComponent.cpp
  51. 0 4
      Gems/EditorPythonBindings/Code/Tests/PythonTestingUtility.h
  52. 0 1
      Gems/LmbrCentral/Code/Tests/Builders/SliceBuilderTests.cpp
  53. 0 1
      Gems/Multiplayer/Code/Tests/CommonBenchmarkSetup.h
  54. 0 1
      Gems/Multiplayer/Code/Tests/MockInterfaces.h
  55. 2 3
      Gems/PhysX/Code/Source/Debug/PhysXDebug.cpp
  56. 0 1
      Gems/ScriptCanvas/Code/Tests/ScriptCanvasBuilderTests.cpp
  57. 0 8
      Gems/ScriptCanvasTesting/Code/Source/Framework/ScriptCanvasTestFixture.h
  58. 3 1
      cmake/Projects.cmake

+ 3 - 4
Code/Editor/CryEdit.cpp

@@ -3974,9 +3974,8 @@ void CCryEditApp::OpenLUAEditor(const char* files)
         }
     }
 
-    const char* engineRoot = nullptr;
-    AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-    AZ_Assert(engineRoot != nullptr, "Unable to communicate to AzFramework::ApplicationRequests::Bus");
+    AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
+    AZ_Assert(!engineRoot.empty(), "Unable to query Engine Path");
 
     AZStd::string_view exePath;
     AZ::ComponentApplicationBus::BroadcastResult(exePath, &AZ::ComponentApplicationRequests::GetExecutableFolder);
@@ -3995,7 +3994,7 @@ void CCryEditApp::OpenLUAEditor(const char* files)
 #endif
         "%s", argumentQuoteString, aznumeric_cast<int>(exePath.size()), exePath.data(), argumentQuoteString);
 
-    AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot);
+    AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot.c_str());
     StartProcessDetached(process.c_str(), processArgs.c_str());
 }
 

+ 0 - 2
Code/Editor/Include/IFileUtil.h

@@ -114,9 +114,7 @@ struct IFileUtil
 
     virtual void ShowInExplorer(const QString& path) = 0;
 
-    virtual bool CompileLuaFile(const char* luaFilename) = 0;
     virtual bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) = 0;
-    virtual void EditTextFile(const char* txtFile, int line = 0, ETextFileType fileType = FILE_TYPE_SCRIPT) = 0;
     virtual void EditTextureFile(const char* txtureFile, bool bUseGameFolder) = 0;
 
     //! dcc filename calculation and extraction sub-routines

+ 2 - 138
Code/Editor/Util/FileUtil.cpp

@@ -23,9 +23,9 @@
 // AzCore
 #include <AzCore/Component/TickBus.h>
 #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
+#include <AzCore/Utils/Utils.h>
 
 // AzFramework
-#include <AzFramework/API/ApplicationAPI.h>
 
 // AzQtComponents
 #include <AzQtComponents/Utilities/DesktopUtilities.h>
@@ -62,84 +62,6 @@ CAutoRestorePrimaryCDRoot::~CAutoRestorePrimaryCDRoot()
     QDir::setCurrent(GetIEditor()->GetPrimaryCDFolder());
 }
 
-bool CFileUtil::CompileLuaFile(const char* luaFilename)
-{
-    QString luaFile = luaFilename;
-
-    if (luaFile.isEmpty())
-    {
-        return false;
-    }
-
-    // Check if this file is in Archive.
-    {
-        CCryFile file;
-        if (file.Open(luaFilename, "rb"))
-        {
-            // Check if in pack.
-            if (file.IsInPak())
-            {
-                return true;
-            }
-        }
-    }
-
-    luaFile = Path::GamePathToFullPath(luaFilename);
-
-    // First try compiling script and see if it have any errors.
-    QString LuaCompiler;
-    QString CompilerOutput;
-
-    // Create the filepath of the lua compiler
-    QString szExeFileName = qApp->applicationFilePath();
-    QString exePath = Path::GetPath(szExeFileName);
-
-#if defined(AZ_PLATFORM_WINDOWS)
-    const char* luaCompiler = "LuaCompiler.exe";
-#else
-    const char* luaCompiler = "lua";
-#endif
-    LuaCompiler = Path::AddPathSlash(exePath) + luaCompiler + " ";
-
-    AZStd::string path = luaFile.toUtf8().data();
-    EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePath, path);
-
-    QString finalPath = path.c_str();
-    finalPath = "\"" + finalPath + "\"";
-
-    // Add the name of the Lua file
-    QString cmdLine = LuaCompiler + finalPath;
-
-    // Execute the compiler and capture the output
-    if (!GetIEditor()->ExecuteConsoleApp(cmdLine, CompilerOutput))
-    {
-        QMessageBox::critical(QApplication::activeWindow(), QString(), QObject::tr("Error while executing '%1', make sure the file is in" \
-            " your Primary CD folder !").arg(luaCompiler));
-        return false;
-    }
-
-    // Check return string
-    if (!CompilerOutput.isEmpty())
-    {
-        // Errors while compiling file.
-
-        // Show output from Lua compiler
-        if (QMessageBox::critical(QApplication::activeWindow(), QObject::tr("Lua Compiler"),
-            QObject::tr("Error output from Lua compiler:\r\n%1\r\nDo you want to edit the file ?").arg(CompilerOutput), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
-        {
-            int line = 0;
-            int index = CompilerOutput.indexOf("at line");
-            if (index >= 0)
-            {
-                azsscanf(CompilerOutput.mid(index).toUtf8().data(), "at line %d", &line);
-            }
-            // Open the Lua file for editing
-            EditTextFile(luaFile.toUtf8().data(), line);
-        }
-        return false;
-    }
-    return true;
-}
 //////////////////////////////////////////////////////////////////////////
 bool CFileUtil::ExtractFile(QString& file, bool bMsgBoxAskForExtraction, const char* pDestinationFilename)
 {
@@ -205,7 +127,7 @@ void CFileUtil::EditTextFile(const char* txtFile, int line, IFileUtil::ETextFile
 {
     QString file = txtFile;
 
-    QString fullPathName =  Path::GamePathToFullPath(file);
+    QString fullPathName = Path::GamePathToFullPath(file);
     ExtractFile(fullPathName);
     QString cmd(fullPathName);
 #if defined (AZ_PLATFORM_WINDOWS)
@@ -301,64 +223,6 @@ void CFileUtil::EditTextureFile(const char* textureFile, [[maybe_unused]] bool b
     }
 }
 
-//////////////////////////////////////////////////////////////////////////
-bool CFileUtil::EditMayaFile(const char* filepath, const bool bExtractFromPak, const bool bUseGameFolder)
-{
-    QString dosFilepath = PathUtil::ToDosPath(filepath).c_str();
-    if (bExtractFromPak)
-    {
-        ExtractFile(dosFilepath);
-    }
-
-    if (bUseGameFolder)
-    {
-        const QString sGameFolder = Path::GetEditingGameDataFolder().c_str();
-        int nLength = sGameFolder.toUtf8().count();
-        if (azstrnicmp(filepath, sGameFolder.toUtf8().data(), nLength) != 0)
-        {
-            dosFilepath = sGameFolder + '\\' + filepath;
-        }
-
-        dosFilepath = PathUtil::ToDosPath(dosFilepath.toUtf8().data()).c_str();
-    }
-
-    const char* engineRoot;
-    EBUS_EVENT_RESULT(engineRoot, AzFramework::ApplicationRequests::Bus, GetEngineRoot);
-
-    const QString fullPath = QString(engineRoot) + '\\' + dosFilepath;
-
-    if (gSettings.animEditor.isEmpty())
-    {
-        AzQtComponents::ShowFileOnDesktop(fullPath);
-    }
-    else
-    {
-        if (!QProcess::startDetached(gSettings.animEditor, { fullPath }))
-        {
-            CryMessageBox("Can't open the file. You can specify a source editor in Sandbox Preferences or create an association in Windows.", "Cannot open file!", MB_OK | MB_ICONERROR);
-        }
-    }
-    return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CFileUtil::EditFile(const char* filePath, const bool bExtrackFromPak, const bool bUseGameFolder)
-{
-    QString extension = filePath;
-    extension.remove(0, extension.lastIndexOf('.'));
-
-    if (extension.compare(".ma") == 0)
-    {
-        return EditMayaFile(filePath, bExtrackFromPak, bUseGameFolder);
-    }
-    else if ((extension.compare(".bspace") == 0) || (extension.compare(".comb") == 0))
-    {
-        EditTextFile(filePath, 0, IFileUtil::FILE_TYPE_BSPACE);
-        return true;
-    }
-
-    return false;
-}
 
 //////////////////////////////////////////////////////////////////////////
 bool CFileUtil::CalculateDccFilename(const QString& assetFilename, QString& dccFilename)

+ 0 - 5
Code/Editor/Util/FileUtil.h

@@ -25,14 +25,9 @@ public:
 
     static void ShowInExplorer(const QString& path);
 
-    // Try to compile the given lua file: returns true if compilation succeeded, false on failure.
-    static bool CompileLuaFile(const char* luaFilename);
-
     static bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr);
     static void EditTextFile(const char* txtFile, int line = 0, IFileUtil::ETextFileType fileType = IFileUtil::FILE_TYPE_SCRIPT);
     static void EditTextureFile(const char* txtureFile, bool bUseGameFolder);
-    static bool EditMayaFile(const char* mayaFile, const bool bExtractFromPak, const bool bUseGameFolder);
-    static bool EditFile(const char* filePath, const bool bExtrackFromPak, const bool bUseGameFolder);
 
     //! dcc filename calculation and extraction sub-routines
     static bool CalculateDccFilename(const QString& assetFilename, QString& dccFilename);

+ 0 - 10
Code/Editor/Util/FileUtil_impl.cpp

@@ -20,21 +20,11 @@ void CFileUtil_impl::ShowInExplorer(const QString& path)
     CFileUtil::ShowInExplorer(path);
 }
 
-bool CFileUtil_impl::CompileLuaFile(const char* luaFilename)
-{
-    return CFileUtil::CompileLuaFile(luaFilename);
-}
-
 bool CFileUtil_impl::ExtractFile(QString& file, bool bMsgBoxAskForExtraction, const char* pDestinationFilename)
 {
     return CFileUtil::ExtractFile(file, bMsgBoxAskForExtraction, pDestinationFilename);
 }
 
-void CFileUtil_impl::EditTextFile(const char* txtFile, int line, ETextFileType fileType)
-{
-    CFileUtil::EditTextFile(txtFile, line, fileType);
-}
-
 void CFileUtil_impl::EditTextureFile(const char* txtureFile, bool bUseGameFolder)
 {
     CFileUtil::EditTextureFile(txtureFile, bUseGameFolder);

+ 0 - 2
Code/Editor/Util/FileUtil_impl.h

@@ -36,9 +36,7 @@ public:
 
     void ShowInExplorer(const QString& path) override;
 
-    bool CompileLuaFile(const char* luaFilename) override;
     bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) override;
-    void EditTextFile(const char* txtFile, int line = 0, ETextFileType fileType = FILE_TYPE_SCRIPT) override;
     void EditTextureFile(const char* txtureFile, bool bUseGameFolder) override;
 
     //! dcc filename calculation and extraction sub-routines

+ 2 - 4
Code/Editor/Util/PathUtil.cpp

@@ -14,7 +14,6 @@
 #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
 #include <AzCore/Utils/Utils.h>
 #include <AzToolsFramework/API/EditorAssetSystemAPI.h> // for ebus events
-#include <AzFramework/API/ApplicationAPI.h>
 #include <AzCore/std/string/conversions.h>
 #include <AzFramework/IO/LocalFileIO.h>
 
@@ -175,9 +174,8 @@ namespace Path
     //////////////////////////////////////////////////////////////////////////
     QString GetEngineRootPath()
     {
-        const char* engineRoot;
-        EBUS_EVENT_RESULT(engineRoot, AzFramework::ApplicationRequests::Bus, GetEngineRoot);
-        return QString(engineRoot);
+        const AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
+        return QString::fromUtf8(engineRoot.c_str(), static_cast<int>(engineRoot.size()));
     }
 
     //////////////////////////////////////////////////////////////////////////

+ 0 - 5
Code/Editor/WelcomeScreen/WelcomeScreenDialog.cpp

@@ -25,8 +25,6 @@
 
 #include <AzCore/Utils/Utils.h>
 
-// AzFramework
-#include <AzFramework/API/ApplicationAPI.h>
 
 // AzToolsFramework
 #include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
@@ -173,9 +171,6 @@ void WelcomeScreenDialog::SetRecentFileList(RecentFileList* pList)
 
     m_pRecentList = pList;
 
-    const char* engineRoot;
-    EBUS_EVENT_RESULT(engineRoot, AzFramework::ApplicationRequests::Bus, GetEngineRoot);
-
     auto projectPath = AZ::Utils::GetProjectPath();
     QString gamePath{projectPath.c_str()};
     Path::ConvertSlashToBackSlash(gamePath);

+ 20 - 32
Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp

@@ -485,16 +485,6 @@ namespace AZ
         constexpr bool executeRegDumpCommands = false;
         SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
 
-        // Query for the Executable Path using OS specific functions
-        CalculateExecutablePath();
-
-        // Determine the path to the engine
-        CalculateEngineRoot();
-
-        // If the current platform returns an engaged optional from Utils::GetDefaultAppRootPath(), that is used
-        // for the application root.
-        CalculateAppRoot();
-
         SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(*m_settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
         SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
         SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*m_settingsRegistry);
@@ -614,7 +604,8 @@ namespace AZ
     {
         AZ_Assert(!m_isStarted, "Component application already started!");
 
-        if (m_engineRoot.empty())
+        using Type = AZ::SettingsRegistryInterface::Type;
+        if (m_settingsRegistry->GetType(SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder) == Type::NoType)
         {
             ReportBadEngineRoot();
             return nullptr;
@@ -1180,6 +1171,24 @@ namespace AZ
         return ReflectionEnvironment::GetReflectionManager() ? ReflectionEnvironment::GetReflectionManager()->GetReflectContext<JsonRegistrationContext>() : nullptr;
     }
 
+    /// Returns the path to the engine.
+
+    const char* ComponentApplication::GetEngineRoot() const
+    {
+        static IO::FixedMaxPathString engineRoot;
+        engineRoot.clear();
+        m_settingsRegistry->Get(engineRoot, SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
+        return engineRoot.c_str();
+    }
+
+    const char* ComponentApplication::GetExecutableFolder() const
+    {
+        static IO::FixedMaxPathString exeFolder;
+        exeFolder.clear();
+        m_settingsRegistry->Get(exeFolder, SettingsRegistryMergeUtils::FilePathKey_BinaryFolder);
+        return exeFolder.c_str();
+    }
+
     //=========================================================================
     // CreateReflectionManager
     //=========================================================================
@@ -1485,27 +1494,6 @@ namespace AZ
         }
     }
 
-    //=========================================================================
-    // CalculateExecutablePath
-    //=========================================================================
-    void ComponentApplication::CalculateExecutablePath()
-    {
-        m_exeDirectory = Utils::GetExecutableDirectory();
-    }
-
-    void ComponentApplication::CalculateAppRoot()
-    {
-        if (AZStd::optional<AZ::StringFunc::Path::FixedString> appRootPath = Utils::GetDefaultAppRootPath(); appRootPath)
-        {
-            m_appRoot = AZStd::move(*appRootPath);
-        }
-    }
-
-    void ComponentApplication::CalculateEngineRoot()
-    {
-        m_engineRoot = AZ::SettingsRegistryMergeUtils::FindEngineRoot(*m_settingsRegistry).Native();
-    }
-
     void ComponentApplication::ResolveModulePath([[maybe_unused]] AZ::OSString& modulePath)
     {
         // No special parsing of the Module Path is done by the Component Application anymore

+ 2 - 17
Code/Framework/AzCore/AzCore/Component/ComponentApplication.h

@@ -221,13 +221,10 @@ namespace AZ
         BehaviorContext* GetBehaviorContext() override;
         /// Returns the json registration context that has been registered with the app, if there is one.
         JsonRegistrationContext* GetJsonRegistrationContext() override;
-        /// Returns the working root folder that has been registered with the app, if there is one.
-        /// It's expected that derived applications will implement an application root.
-        const char* GetAppRoot() const override { return m_appRoot.c_str(); }
         /// Returns the path to the engine.
-        const char* GetEngineRoot() const override { return m_engineRoot.c_str(); }
+        const char* GetEngineRoot() const override;
         /// Returns the path to the folder the executable is in.
-        const char* GetExecutableFolder() const override { return m_exeDirectory.c_str(); }
+        const char* GetExecutableFolder() const override;
 
         //////////////////////////////////////////////////////////////////////////
         /// TickRequestBus
@@ -352,15 +349,6 @@ namespace AZ
         /// Adds system components requested by modules and the application to the system entity.
         void AddRequiredSystemComponents(AZ::Entity* systemEntity);
 
-        /// Calculates the directory the application executable comes from.
-        void CalculateExecutablePath();
-
-        /// Calculates the root directory of the engine.
-        void CalculateEngineRoot();
-
-        /// Deprecated: The term "AppRoot" has no meaning
-        void CalculateAppRoot();
-
         template<typename Iterator>
         static void NormalizePath(Iterator begin, Iterator end, bool doLowercase = true)
         {
@@ -388,9 +376,6 @@ namespace AZ
         void*                                       m_fixedMemoryBlock{ nullptr }; //!< Pointer to the memory block allocator, so we can free it OnDestroy.
         IAllocatorAllocate*                         m_osAllocator{ nullptr };
         EntitySetType                               m_entities;
-        AZ::IO::FixedMaxPath                        m_exeDirectory;
-        AZ::IO::FixedMaxPath                        m_engineRoot;
-        AZ::IO::FixedMaxPath                        m_appRoot;
 
         AZ::SettingsRegistryInterface::NotifyEventHandler m_projectPathChangedHandler;
         AZ::SettingsRegistryInterface::NotifyEventHandler m_projectNameChangedHandler;

+ 0 - 4
Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h

@@ -175,10 +175,6 @@ namespace AZ
         //! the serializers used by the best-effort json serialization.
         virtual class JsonRegistrationContext* GetJsonRegistrationContext() = 0;
 
-        //! Gets the name of the working root folder that was registered with the app.
-        //! @return a pointer to the name of the app's root folder, if a root folder was registered.
-        virtual const char* GetAppRoot() const = 0;
-
         //! Gets the path of the working engine folder that the app is a part of.
         //! @return a pointer to the engine path.
         virtual const char* GetEngineRoot() const = 0;

+ 3 - 1
Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp

@@ -266,7 +266,8 @@ namespace AZ::SettingsRegistryMergeUtils
 
         // Step 3 locate the project root and attempt to find the engine root using the registered engine
         // for the project in the project.json file
-        AZ::IO::FixedMaxPath projectRoot = FindProjectRoot(settingsRegistry);
+        AZ::IO::FixedMaxPath projectRoot;
+        settingsRegistry.Get(projectRoot.Native(), FilePathKey_ProjectPath);
         if (projectRoot.empty())
         {
             return {};
@@ -693,6 +694,7 @@ namespace AZ::SettingsRegistryMergeUtils
                 R"(Project path isn't set in the Settings Registry at "%.*s".)"
                 " Project-related filepaths will be set relative to the executable directory\n",
                 AZ_STRING_ARG(projectPathKey));
+            projectPath = exePath;
             registry.Set(FilePathKey_ProjectPath, exePath.Native());
         }
 

+ 27 - 17
Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp

@@ -1427,26 +1427,36 @@ namespace AZ
 
         namespace AssetPath
         {
-            void CalculateBranchToken(const AZStd::string& appRootPath, AZStd::string& token)
+            namespace Internal
             {
-                // Normalize the token to prepare for CRC32 calculation
-                AZStd::string normalized = appRootPath;
-
-                // Strip out any trailing path separators
-                AZ::StringFunc::Strip(normalized, AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING  AZ_WRONG_FILESYSTEM_SEPARATOR_STRING,false, false, true);
-
-                // Lower case always
-                AZStd::to_lower(normalized.begin(), normalized.end());
+                AZ::u32 CalculateBranchTokenHash(AZStd::string_view engineRootPath)
+                {
+                    // Normalize the token to prepare for CRC32 calculation
+                    auto NormalizeEnginePath = [](const char element) -> char
+                    {
+                        // Substitute path separators with '_' and lower case
+                        return element == AZ::IO::WindowsPathSeparator || element == AZ::IO::PosixPathSeparator
+                            ? '_' : static_cast<char>(std::tolower(element));
+                    };
 
-                // Substitute path separators with '_'
-                AZStd::replace(normalized.begin(), normalized.end(), '\\', '_');
-                AZStd::replace(normalized.begin(), normalized.end(), '/', '_');
+                    // Trim off trailing path separators
+                    engineRootPath = RStrip(engineRootPath, AZ_CORRECT_AND_WRONG_FILESYSTEM_SEPARATOR);
+                    AZ::IO::FixedMaxPathString enginePath;
+                    AZStd::transform(engineRootPath.begin(), engineRootPath.end(),
+                        AZStd::back_inserter(enginePath), AZStd::move(NormalizeEnginePath));
 
-                // Perform the CRC32 calculation
-                const AZ::Crc32 branchTokenCrc(normalized.c_str(), normalized.size(), true);
-                char branchToken[12];
-                azsnprintf(branchToken, AZ_ARRAY_SIZE(branchToken), "0x%08X", static_cast<AZ::u32>(branchTokenCrc));
-                token = AZStd::string(branchToken);
+                    // Perform the CRC32 calculation
+                    constexpr bool forceLowercase = true;
+                    return static_cast<AZ::u32>(AZ::Crc32(enginePath.c_str(), enginePath.size(), forceLowercase));
+                }
+            }
+            void CalculateBranchToken(AZStd::string_view engineRootPath, AZStd::string& token)
+            {
+                token = AZStd::string::format("0x%08X", Internal::CalculateBranchTokenHash(engineRootPath));
+            }
+            void CalculateBranchToken(AZStd::string_view engineRootPath, AZ::IO::FixedMaxPathString& token)
+            {
+                token = AZ::IO::FixedMaxPathString::format("0x%08X", Internal::CalculateBranchTokenHash(engineRootPath));
             }
         }
 

+ 3 - 2
Code/Framework/AzCore/AzCore/StringFunc/StringFunc.h

@@ -485,10 +485,11 @@ namespace AZ
             //! CalculateBranchToken
             /*! Calculate the branch token that is used for asset processor connection negotiations
             *
-            * \param appRootPath - The absolute path of the app root to base the token calculation on
+            * \param engineRootPath - The absolute path to the engine root to base the token calculation on
             * \param token       - The result of the branch token calculation
             */
-            void CalculateBranchToken(const AZStd::string& appRootPath, AZStd::string& token);
+            void CalculateBranchToken(AZStd::string_view engineRootPath, AZStd::string& token);
+            void CalculateBranchToken(AZStd::string_view engineRootPath, AZ::IO::FixedMaxPathString& token);
         }
 
         //////////////////////////////////////////////////////////////////////////

+ 0 - 1
Code/Framework/AzCore/AzCore/UnitTest/MockComponentApplication.h

@@ -41,7 +41,6 @@ namespace UnitTest
         MOCK_METHOD0(GetSerializeContext, AZ::SerializeContext* ());
         MOCK_METHOD0(GetJsonRegistrationContext, AZ::JsonRegistrationContext* ());
         MOCK_METHOD0(GetBehaviorContext, AZ::BehaviorContext* ());
-        MOCK_CONST_METHOD0(GetAppRoot, const char* ());
         MOCK_CONST_METHOD0(GetEngineRoot, const char* ());
         MOCK_CONST_METHOD0(GetExecutableFolder, const char* ());
         MOCK_CONST_METHOD1(QueryApplicationType, void(AZ::ApplicationTypeQuery&));

+ 0 - 1
Code/Framework/AzCore/Tests/BehaviorContextFixture.h

@@ -59,7 +59,6 @@ namespace UnitTest
         AZ::SerializeContext* GetSerializeContext() override { return nullptr; }
         AZ::BehaviorContext*  GetBehaviorContext() override { return m_behaviorContext; }
         AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
         void EnumerateEntities(const EntityCallback& /*callback*/) override {}

+ 7 - 13
Code/Framework/AzCore/Tests/Components.cpp

@@ -1060,26 +1060,21 @@ namespace UnitTest
     /**
      * UserSettingsComponent test
      */
-     class UserSettingsTestApp
-         : public ComponentApplication
-         , public UserSettingsFileLocatorBus::Handler
-     {
-     public:
-         void SetExecutableFolder(const char* path)
-         {
-             m_exeDirectory = path;
-         }
-
+    class UserSettingsTestApp
+        : public ComponentApplication
+        , public UserSettingsFileLocatorBus::Handler
+    {
+    public:
         AZStd::string ResolveFilePath(u32 providerId) override
         {
             AZStd::string filePath;
             if (providerId == UserSettings::CT_GLOBAL)
             {
-                filePath = (m_exeDirectory / "GlobalUserSettings.xml").String();
+                filePath = (AZ::IO::Path(GetTestFolderPath()) / "GlobalUserSettings.xml").Native();
             }
             else if (providerId == UserSettings::CT_LOCAL)
             {
-                filePath = (m_exeDirectory / "LocalUserSettings.xml").String();
+                filePath = (AZ::IO::Path(GetTestFolderPath()) / "LocalUserSettings.xml").Native();
             }
             return filePath;
         }
@@ -1117,7 +1112,6 @@ namespace UnitTest
         ComponentApplication::Descriptor appDesc;
         appDesc.m_memoryBlocksByteSize = 10 * 1024 * 1024;
         Entity* systemEntity = app.Create(appDesc);
-        app.SetExecutableFolder(GetTestFolderPath().c_str());
         app.UserSettingsFileLocatorBus::Handler::BusConnect();
 
         // Make sure user settings file does not exist at this point

+ 0 - 1
Code/Framework/AzCore/Tests/Serialization.cpp

@@ -1240,7 +1240,6 @@ namespace UnitTest
         SerializeContext* GetSerializeContext() override { return m_serializeContext.get(); }
         BehaviorContext*  GetBehaviorContext() override { return nullptr; }
         JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
         void EnumerateEntities(const EntityCallback& /*callback*/) override {}

+ 0 - 6
Code/Framework/AzFramework/AzFramework/API/ApplicationAPI.h

@@ -67,12 +67,6 @@ namespace AzFramework
         /// Make path relative to the provided root.
         virtual void MakePathRelative(AZStd::string& /*fullPath*/, const char* /*rootPath*/) {}
 
-        /// Gets the engine root path where the modules for the current engine are located.
-        virtual const char* GetEngineRoot() const { return nullptr; }
-
-        /// Retrieves the app root path for the application.
-        virtual const char* GetAppRoot() const { return nullptr; }
-
         /// Get the Command Line arguments passed in.
         virtual const CommandLine* GetCommandLine() { return nullptr; }
 

+ 3 - 39
Code/Framework/AzFramework/AzFramework/Application/Application.cpp

@@ -225,13 +225,6 @@ namespace AzFramework
         }
     }
 
-    void Application::PreModuleLoad()
-    {
-        SetRootPath(RootPathType::EngineRoot, m_engineRoot.c_str());
-        AZ_TracePrintf(s_azFrameworkWarningWindow, "Engine Path: %s\n", m_engineRoot.c_str());
-    }
-
-
     void Application::Stop()
     {
         if (m_isStarted)
@@ -397,11 +390,6 @@ namespace AzFramework
         outModules.emplace_back(aznew AzFrameworkModule());
     }
 
-    const char* Application::GetAppRoot() const
-    {
-        return m_appRoot.c_str();
-    }
-
     const char* Application::GetCurrentConfigurationName() const
     {
 #if defined(_RELEASE)
@@ -437,19 +425,19 @@ namespace AzFramework
 
     void Application::ResolveEnginePath(AZStd::string& engineRelativePath) const
     {
-        AZ::IO::FixedMaxPath fullPath = m_engineRoot / engineRelativePath;
+        auto fullPath = AZ::IO::FixedMaxPath(GetEngineRoot()) / engineRelativePath;
         engineRelativePath = fullPath.String();
     }
 
     void Application::CalculateBranchTokenForEngineRoot(AZStd::string& token) const
     {
-        AzFramework::StringFunc::AssetPath::CalculateBranchToken(m_engineRoot.String(), token);
+        AZ::StringFunc::AssetPath::CalculateBranchToken(GetEngineRoot(), token);
     }
 
     ////////////////////////////////////////////////////////////////////////////
     void Application::MakePathRootRelative(AZStd::string& fullPath)
     {
-        MakePathRelative(fullPath, m_engineRoot.c_str());
+        MakePathRelative(fullPath, GetEngineRoot());
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -585,30 +573,6 @@ namespace AzFramework
         }
     }
 
-    void Application::SetRootPath(RootPathType type, const char* source)
-    {
-        [[maybe_unused]] const size_t sourceLen = strlen(source);
-
-        // Copy the source path to the intended root path and correct the path separators as well
-        switch (type)
-        {
-        case RootPathType::AppRoot:
-        {
-            AZ_Assert(sourceLen < m_appRoot.Native().max_size(), "String overflow for App Root: %s", source);
-            m_appRoot = AZ::IO::PathView(source).LexicallyNormal();
-        }
-        break;
-        case RootPathType::EngineRoot:
-        {
-            AZ_Assert(sourceLen < m_engineRoot.Native().max_size(), "String overflow for Engine Root: %s", source);
-            m_engineRoot = AZ::IO::PathView(source).LexicallyNormal();
-        }
-        break;
-        default:
-            AZ_Assert(false, "Invalid RootPathType (%d)", static_cast<int>(type));
-        }
-    }
-
     struct DeprecatedAliasesKeyVisitor
         : AZ::SettingsRegistryInterface::Visitor
     {

+ 1 - 11
Code/Framework/AzFramework/AzFramework/Application/Application.h

@@ -95,8 +95,6 @@ namespace AzFramework
 
         //////////////////////////////////////////////////////////////////////////
         //! ApplicationRequests::Bus::Handler
-        const char* GetEngineRoot() const override { return m_engineRoot.c_str(); }
-        const char* GetAppRoot() const override;
         void ResolveEnginePath(AZStd::string& engineRelativePath) const override;
         void CalculateBranchTokenForEngineRoot(AZStd::string& token) const override;
         bool IsPrefabSystemEnabled() const override;
@@ -146,8 +144,6 @@ namespace AzFramework
          */
         void SetFileIOAliases();
 
-        void PreModuleLoad() override;
-
         //////////////////////////////////////////////////////////////////////////
         //! AZ::ComponentApplication
         void RegisterCoreComponents() override;
@@ -181,13 +177,7 @@ namespace AzFramework
         bool m_ownsConsole = false;
 
         bool m_exitMainLoopRequested = false;
-        
-        enum class RootPathType
-        {
-            AppRoot,
-            EngineRoot
-        };
-        void SetRootPath(RootPathType type, const char* source);
+
     };
 } // namespace AzFramework
 

+ 8 - 12
Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp

@@ -14,7 +14,7 @@
 #include <AzCore/Module/DynamicModuleHandle.h>
 #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
 #include <AzCore/StringFunc/StringFunc.h>
-#include <AzFramework/API/ApplicationAPI.h>
+#include <AzCore/Utils/Utils.h>
 #include <AzFramework/IO/LocalFileIO.h>
 #include <AzToolsFramework/API/EditorAssetSystemAPI.h>
 #include <AzToolsFramework/Asset/AssetUtils.h>
@@ -205,7 +205,7 @@ namespace AzToolsFramework::AssetUtils
         return platformConfigFilePathsAdded;
     }
 
-    AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view assetRoot, AZStd::string_view projectPath,
+    AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view projectPath,
         bool addPlatformConfigs, bool addGemsConfigs, AZ::SettingsRegistryInterface* settingsRegistry)
     {
         constexpr const char* AssetProcessorGamePlatformConfigFileName = "AssetProcessorGamePlatformConfig.ini";
@@ -232,14 +232,13 @@ namespace AzToolsFramework::AssetUtils
             Internal::AddGemConfigFiles(gemInfoList, configFiles);
         }
 
-        AZ::IO::Path assetRootDir(assetRoot);
-        assetRootDir /= projectPath;
+        AZ::IO::Path projectRoot(projectPath);
 
-        AZ::IO::Path projectConfigFile = assetRootDir / AssetProcessorGamePlatformConfigFileName;
+        AZ::IO::Path projectConfigFile = projectRoot / AssetProcessorGamePlatformConfigFileName;
         configFiles.push_back(projectConfigFile);
 
         // Add a file entry for the Project AssetProcessor setreg file
-        projectConfigFile = assetRootDir / AssetProcessorGamePlatformConfigSetreg;
+        projectConfigFile = projectRoot / AssetProcessorGamePlatformConfigSetreg;
         configFiles.push_back(projectConfigFile);
 
         return configFiles;
@@ -251,10 +250,10 @@ namespace AzToolsFramework::AssetUtils
         AZStd::vector<AZStd::string> tokens;
         AZ::StringFunc::Tokenize(relPathFromRoot.c_str(), tokens, AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING);
 
-        AZStd::string validatedPath;
+        AZ::IO::FixedMaxPath validatedPath;
         if (rootPath.empty())
         {
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(validatedPath, &AzFramework::ApplicationRequests::GetEngineRoot);
+            validatedPath = AZ::Utils::GetEnginePath();
         }
         else
         {
@@ -299,10 +298,7 @@ namespace AzToolsFramework::AssetUtils
                 break;
             }
 
-            AZStd::string absoluteFilePath;
-            AZ::StringFunc::Path::ConstructFull(validatedPath.c_str(), element.c_str(), absoluteFilePath);
-
-            validatedPath = absoluteFilePath; // go one step deeper.
+            validatedPath /= element; // go one step deeper.
         }
 
         if (success)

+ 1 - 1
Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.h

@@ -40,7 +40,7 @@ namespace AzToolsFramework::AssetUtils
     //! Also note that if the project has any "game project gems", then those will also be inserted last, 
     //! and thus have a higher priority than the root or non - project gems.
     //! Also note that the game project could be in a different location to the engine therefore we need the assetRoot param.
-    AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view assetRoot, AZStd::string_view projectPath,
+    AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view projectPath,
         bool addPlatformConfigs = true, bool addGemsConfigs = true, AZ::SettingsRegistryInterface* settingsRegistry = nullptr);
 
     //! A utility function which checks the given path starting at the root and updates the relative path to be the actual case correct path.

+ 4 - 6
Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Thumbnails/SourceThumbnail.cpp

@@ -9,11 +9,11 @@
 #include <AzCore/EBus/Results.h>
 #include <AzCore/std/string/string.h>
 #include <AzCore/std/containers/vector.h>
+#include <AzCore/Utils/Utils.h>
 #include <AzFramework/StringFunc/StringFunc.h>
 #include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
 #include <AzToolsFramework/API/EditorAssetSystemAPI.h>
 #include <AzToolsFramework/AssetBrowser/Thumbnails/SourceThumbnail.h>
-#include <AzFramework/API/ApplicationAPI.h>
 #include <QString>
 
 namespace AzToolsFramework
@@ -113,11 +113,9 @@ namespace AzToolsFramework
 
             if (iconPathToUse.isEmpty())
             {
-                const char* engineRoot = nullptr;
-                AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-                AZ_Assert(engineRoot, "Engine Root not initialized");
-                AZStd::string iconPath = AZStd::string::format("%s%s", engineRoot, DefaultFileIconPath);
-                iconPathToUse = iconPath.c_str();
+                AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
+                AZ_Assert(!engineRoot.empty(), "Engine Root not initialized");
+                iconPathToUse = (engineRoot / DefaultFileIconPath).c_str();
             }
 
             m_pixmap.load(iconPathToUse);

+ 9 - 9
Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/SourceControlThumbnail.cpp

@@ -6,10 +6,10 @@
  *
  */
 
-#include <AzFramework/StringFunc/StringFunc.h>
+#include <AzCore/StringFunc/StringFunc.h>
+#include <AzCore/Utils/Utils.h>
 #include <AzToolsFramework/Thumbnails/SourceControlThumbnail.h>
 #include <AzToolsFramework/SourceControl/SourceControlAPI.h>
-#include <AzFramework/API/ApplicationAPI.h>
 
 namespace AzToolsFramework
 {
@@ -68,12 +68,12 @@ namespace AzToolsFramework
         SourceControlThumbnail::SourceControlThumbnail(SharedThumbnailKey key)
             : Thumbnail(key)
         {
-            const char* engineRoot = nullptr;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-            AZ_Assert(engineRoot, "Engine Root not initialized");
+            AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
+            AZ_Assert(!engineRoot.empty(), "Engine Root not initialized");
+
+            m_writableIconPath = (engineRoot / WRITABLE_ICON_PATH).String();
+            m_nonWritableIconPath = (engineRoot / NONWRITABLE_ICON_PATH).String();
 
-            AzFramework::StringFunc::Path::Join(engineRoot, WRITABLE_ICON_PATH, m_writableIconPath);
-            AzFramework::StringFunc::Path::Join(engineRoot, NONWRITABLE_ICON_PATH, m_nonWritableIconPath);
 
             BusConnect();
         }
@@ -90,8 +90,8 @@ namespace AzToolsFramework
             AZ_Assert(sourceControlKey, "Incorrect key type, excpected SourceControlThumbnailKey");
 
             AZStd::string myFileName(sourceControlKey->GetFileName());
-            AzFramework::StringFunc::Path::Normalize(myFileName);
-            if (AzFramework::StringFunc::Equal(myFileName.c_str(), filename))
+            AZ::StringFunc::Path::Normalize(myFileName);
+            if (AZ::StringFunc::Equal(myFileName.c_str(), filename))
             {
                 Update();
             }

+ 0 - 1
Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp

@@ -1116,7 +1116,6 @@ namespace UnitTest
         SerializeContext* GetSerializeContext() override { return m_serializeContext.get(); }
         BehaviorContext*  GetBehaviorContext() override { return nullptr; }
         JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
         void EnumerateEntities(const EntityCallback& /*callback*/) override {}

+ 0 - 5
Code/Framework/AzToolsFramework/Tests/UI/EntityPropertyEditorTests.cpp

@@ -36,11 +36,6 @@ namespace UnitTest
         : public ComponentApplication
     {
     public:
-        void SetExecutableFolder(const char* path)
-        {
-            m_exeDirectory = path;
-        }
-
         void SetSettingsRegistrySpecializations(SettingsRegistryInterface::Specializations& specializations) override
         {
             ComponentApplication::SetSettingsRegistrySpecializations(specializations);

+ 1 - 3
Code/Tools/AssetBundler/source/utils/GUIApplicationManager.cpp

@@ -346,9 +346,7 @@ namespace AssetBundler
         }
 
         // Determine the enabled platforms
-        const char* appRoot = nullptr;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
-        m_enabledPlatforms = GetEnabledPlatformFlags(GetEngineRoot(), appRoot, AZ::Utils::GetProjectPath().c_str());
+        m_enabledPlatforms = GetEnabledPlatformFlags(GetEngineRoot(), AZStd::string_view(AZ::Utils::GetProjectPath()));
 
         // Determine which Gems are enabled for the current project
         if (!AzFramework::GetGemsInfo(m_gemInfoList, *m_settingsRegistry))

+ 0 - 1
Code/Tools/AssetBundler/source/utils/applicationManager.cpp

@@ -1401,7 +1401,6 @@ namespace AssetBundler
 
         // If no platform was specified, defaulting to platforms specified in the asset processor config files
         AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(
-            AZStd::string_view{ AZ::Utils::GetEnginePath() },
             AZStd::string_view{ AZ::Utils::GetEnginePath() },
             AZStd::string_view{ AZ::Utils::GetProjectPath() });
         [[maybe_unused]] auto platformsString = AzFramework::PlatformHelper::GetCommaSeparatedPlatformList(platformFlags);

+ 1 - 2
Code/Tools/AssetBundler/source/utils/utils.cpp

@@ -377,7 +377,6 @@ namespace AssetBundler
 
     AzFramework::PlatformFlags GetEnabledPlatformFlags(
         AZStd::string_view engineRoot,
-        AZStd::string_view assetRoot,
         AZStd::string_view projectPath)
     {
         auto settingsRegistry = AZ::SettingsRegistry::Get();
@@ -387,7 +386,7 @@ namespace AssetBundler
             return AzFramework::PlatformFlags::Platform_NONE;
         }
 
-        auto configFiles = AzToolsFramework::AssetUtils::GetConfigFiles(engineRoot, assetRoot, projectPath, true, true, settingsRegistry);
+        auto configFiles = AzToolsFramework::AssetUtils::GetConfigFiles(engineRoot, projectPath, true, true, settingsRegistry);
         auto enabledPlatformList = AzToolsFramework::AssetUtils::GetEnabledPlatforms(*settingsRegistry, configFiles);
         AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_NONE;
         for (const auto& enabledPlatform : enabledPlatformList)

+ 0 - 1
Code/Tools/AssetBundler/source/utils/utils.h

@@ -221,7 +221,6 @@ namespace AssetBundler
     //! Please note that the game project could be in a different location to the engine therefore we need the assetRoot param.
     AzFramework::PlatformFlags GetEnabledPlatformFlags(
         AZStd::string_view enginePath,
-        AZStd::string_view assetRoot,
         AZStd::string_view projectPath);
 
     QJsonObject ReadJson(const AZStd::string& filePath);

+ 8 - 8
Code/Tools/AssetBundler/tests/UtilsTests.cpp

@@ -67,7 +67,7 @@ namespace AssetBundler
         void NormalizePathKeepCase(AZStd::string& /*path*/) override {}
         void CalculateBranchTokenForEngineRoot(AZStd::string& /*token*/) const override {}
 
-        const char* GetEngineRoot() const override
+        const char* GetTempDir() const
         {
             return m_tempDir->GetDirectory();
         }
@@ -83,7 +83,7 @@ namespace AssetBundler
     TEST_F(MockUtilsTest, DISABLED_TestFilePath_StartsWithAFileSeparator_Valid)
     {
         AZ::IO::Path relFilePath = "Foo/foo.xml";
-        AZ::IO::Path absoluteFilePath = AZ::IO::PathView(GetEngineRoot()).RootPath();
+        AZ::IO::Path absoluteFilePath = AZ::IO::PathView(GetTempDir()).RootPath();
         absoluteFilePath /= relFilePath;
         absoluteFilePath = absoluteFilePath.LexicallyNormal();
 
@@ -95,7 +95,7 @@ namespace AssetBundler
     TEST_F(MockUtilsTest, TestFilePath_RelativePath_Valid)
     {
         AZ::IO::Path relFilePath = "Foo\\foo.xml";
-        AZ::IO::Path absoluteFilePath = (AZ::IO::Path(GetEngineRoot()) / relFilePath).LexicallyNormal();
+        AZ::IO::Path absoluteFilePath = (AZ::IO::Path(GetTempDir()) / relFilePath).LexicallyNormal();
         FilePath filePath(relFilePath.Native());
         EXPECT_EQ(AZ::IO::PathView{ filePath.AbsolutePath() }, absoluteFilePath);
     }
@@ -107,8 +107,8 @@ namespace AssetBundler
         AZ::IO::Path relFilePath = "Foo\\Foo.xml";
         AZ::IO::Path wrongCaseRelFilePath = "Foo\\foo.xml";
 
-        AZ::IO::Path correctAbsoluteFilePath = (AZ::IO::Path(GetEngineRoot()) / relFilePath).LexicallyNormal();
-        AZ::IO::Path wrongCaseAbsoluteFilePath = (AZ::IO::Path(GetEngineRoot()) / wrongCaseRelFilePath).LexicallyNormal();
+        AZ::IO::Path correctAbsoluteFilePath = (AZ::IO::Path(GetTempDir()) / relFilePath).LexicallyNormal();
+        AZ::IO::Path wrongCaseAbsoluteFilePath = (AZ::IO::Path(GetTempDir()) / wrongCaseRelFilePath).LexicallyNormal();
 
         AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle;
         AZ::IO::FileIOBase::GetInstance()->Open(correctAbsoluteFilePath.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeCreatePath, fileHandle);
@@ -121,7 +121,7 @@ namespace AssetBundler
     TEST_F(MockUtilsTest, TestFilePath_NoFileExists_NoError_valid)
     {
         AZ::IO::Path relFilePath = "Foo\\Foo.xml";
-        AZ::IO::Path absoluteFilePath = (AZ::IO::Path(GetEngineRoot()) / relFilePath).LexicallyNormal();
+        AZ::IO::Path absoluteFilePath = (AZ::IO::Path(GetTempDir()) / relFilePath).LexicallyNormal();
 
         FilePath filePath(absoluteFilePath.Native(), true, false);
         EXPECT_TRUE(filePath.IsValid());
@@ -132,8 +132,8 @@ namespace AssetBundler
     {
         AZStd::string relFilePath = "Foo\\Foo.xml";
         AZStd::string wrongCaseRelFilePath = "Foo\\foo.xml";
-        AZ::IO::Path correctAbsoluteFilePath = (AZ::IO::Path(GetEngineRoot()) / relFilePath).LexicallyNormal();
-        AZ::IO::Path wrongCaseAbsoluteFilePath = (AZ::IO::Path(GetEngineRoot()) / wrongCaseRelFilePath).LexicallyNormal();
+        AZ::IO::Path correctAbsoluteFilePath = (AZ::IO::Path(GetTempDir()) / relFilePath).LexicallyNormal();
+        AZ::IO::Path wrongCaseAbsoluteFilePath = (AZ::IO::Path(GetTempDir()) / wrongCaseRelFilePath).LexicallyNormal();
 
         AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle;
         AZ::IO::FileIOBase::GetInstance()->Open(correctAbsoluteFilePath.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeCreatePath, fileHandle);

+ 6 - 5
Code/Tools/AssetBundler/tests/applicationManagerTests.cpp

@@ -16,6 +16,7 @@
 #include <AzCore/Settings/SettingsRegistryImpl.h>
 #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
 #include <AzCore/UserSettings/UserSettingsComponent.h>
+#include <AzCore/Utils/Utils.h>
 
 #include <source/utils/utils.h>
 #include <source/utils/applicationManager.h>
@@ -84,10 +85,9 @@ namespace AssetBundler
             // in the unit tests.
             AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
 
-            const char* engineRoot = nullptr;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-            ASSERT_TRUE(engineRoot) << "Unable to locate engine root.\n";
-            AzFramework::StringFunc::Path::Join(engineRoot, RelativeTestFolder, m_data->m_testEngineRoot);
+            AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
+            ASSERT_TRUE(!engineRoot.empty()) << "Unable to locate engine root.\n";
+            m_data->m_testEngineRoot = (engineRoot / RelativeTestFolder).String();
 
             m_data->m_localFileIO = aznew AZ::IO::LocalFileIO();
             m_data->m_priorFileIO = AZ::IO::FileIOBase::GetInstance();
@@ -150,7 +150,8 @@ namespace AssetBundler
 
         EXPECT_EQ(0, gemsNameMap.size());
 
-        AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(m_data->m_testEngineRoot.c_str(), m_data->m_testEngineRoot.c_str(), DummyProjectName);
+        const auto testProjectPath = AZ::IO::Path(m_data->m_testEngineRoot) / DummyProjectName;
+        AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(m_data->m_testEngineRoot, testProjectPath.Native());
         AzFramework::PlatformFlags hostPlatformFlag = AzFramework::PlatformHelper::GetPlatformFlag(AzToolsFramework::AssetSystem::GetHostAssetPlatform());
         AzFramework::PlatformFlags expectedFlags = AzFramework::PlatformFlags::Platform_ANDROID | AzFramework::PlatformFlags::Platform_IOS | AzFramework::PlatformFlags::Platform_PROVO | hostPlatformFlag;
         ASSERT_EQ(platformFlags, expectedFlags);

+ 24 - 12
Code/Tools/AssetProcessor/native/tests/platformconfiguration/platformconfigurationtests.cpp

@@ -52,11 +52,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_BadPlatform)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_broken_badplatform");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_GT(m_absorber.m_numErrorsAbsorbed, 0);
 }
 
@@ -67,11 +68,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_NoPlatform)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_broken_noplatform");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_GT(m_absorber.m_numErrorsAbsorbed, 0);
 }
 
@@ -81,11 +83,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_NoScanFolders)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_broken_noscans");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_GT(m_absorber.m_numErrorsAbsorbed, 0);
 }
 
@@ -95,11 +98,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_BrokenRecognizers)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_broken_recognizers");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_GT(m_absorber.m_numErrorsAbsorbed, 0);
 }
 
@@ -109,11 +113,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Regular_Platforms)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_regular");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_EQ(m_absorber.m_numErrorsAbsorbed, 0);
 
     // verify the data.
@@ -322,12 +327,13 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularScanfolder)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_regular");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
     AssetUtilities::ComputeProjectName(EmptyDummyProjectName, true);
-    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_EQ(m_absorber.m_numErrorsAbsorbed, 0);
 
     ASSERT_EQ(config.GetScanFolderCount(), 3); // the two, and then the one that has the same data as prior but different identifier.
@@ -356,11 +362,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularScanfolderP
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_regular_platform_scanfolder");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_EQ(m_absorber.m_numErrorsAbsorbed, 0);
 
     ASSERT_EQ(config.GetScanFolderCount(), 5);
@@ -402,11 +409,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularExcludes)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_regular");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_EQ(m_absorber.m_numErrorsAbsorbed, 0);
 
     ASSERT_TRUE(config.IsFileExcluded("blahblah/$tmp_01.test"));
@@ -427,11 +435,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Recognizers)
 #endif
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_regular");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_EQ(m_absorber.m_numErrorsAbsorbed, 0);
 
     const AssetProcessor::RecognizerContainer& recogs = config.GetAssetRecognizerContainer();
@@ -518,12 +527,13 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Overrides)
     using namespace AzToolsFramework::AssetSystem;
     using namespace AssetProcessor;
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / DummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_regular");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
 
-    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), DummyProjectName, false, false));
+    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_EQ(m_absorber.m_numErrorsAbsorbed, 0);
 
     const AssetProcessor::RecognizerContainer& recogs = config.GetAssetRecognizerContainer();
@@ -625,11 +635,12 @@ TEST_F(PlatformConfigurationUnitTests, ReadCheckServer_FromConfig_Valid)
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_regular");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_TRUE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_EQ(m_absorber.m_numErrorsAbsorbed, 0);
 
     const AssetProcessor::RecognizerContainer& recogs = config.GetAssetRecognizerContainer();
@@ -674,11 +685,12 @@ TEST_F(PlatformConfigurationUnitTests, Test_MetaFileTypes_AssetImporterExtension
     using namespace AssetProcessor;
 
     const auto testExeFolder = AZ::IO::FileIOBase::GetInstance()->ResolvePath(TestAppRoot);
+    const AZ::IO::FixedMaxPath projectPath = (*testExeFolder) / EmptyDummyProjectName;
     auto configRoot = AZ::IO::FileIOBase::GetInstance()->ResolvePath("@exefolder@/testdata/config_metadata");
     ASSERT_TRUE(configRoot);
     UnitTestPlatformConfiguration config;
     m_absorber.Clear();
-    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), EmptyDummyProjectName, false, false));
+    ASSERT_FALSE(config.InitializeFromConfigFiles(configRoot->c_str(), testExeFolder->c_str(), projectPath.c_str(), false, false));
     ASSERT_GT(m_absorber.m_numErrorsAbsorbed, 0);
     ASSERT_TRUE(config.MetaDataFileTypesCount() == 2);
 

+ 1 - 1
Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp

@@ -749,7 +749,7 @@ namespace AssetProcessor
         }
 
         AZStd::vector<AZ::IO::Path> configFiles = AzToolsFramework::AssetUtils::GetConfigFiles(absoluteSystemRoot.toUtf8().constData(),
-            absoluteAssetRoot.toUtf8().constData(), projectPath.toUtf8().constData(),
+            projectPath.toUtf8().constData(),
             addPlatformConfigs, addGemsConfigs && !noGemScanFolders, settingsRegistry);
 
         // First Merge all Engine, Gem and Project specific AssetProcessor*Config.setreg/.inifiles

+ 0 - 1
Code/Tools/PythonBindingsExample/source/Application.cpp

@@ -39,7 +39,6 @@ namespace PythonBindingsExample
         AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
 
         // prepare the Python binding gem(s)
-        CalculateExecutablePath();
         Start(Descriptor());
 
         AZ::SerializeContext* context;

+ 0 - 1
Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp

@@ -368,7 +368,6 @@ namespace AZ::SceneAPI::Containers
         MOCK_METHOD0(GetSerializeContext, AZ::SerializeContext* ());
         MOCK_METHOD0(GetJsonRegistrationContext, AZ::JsonRegistrationContext* ());
         MOCK_METHOD0(GetBehaviorContext, AZ::BehaviorContext* ());
-        MOCK_CONST_METHOD0(GetAppRoot, const char*());
         MOCK_CONST_METHOD0(GetEngineRoot, const char*());
         MOCK_CONST_METHOD0(GetExecutableFolder, const char* ());
         MOCK_CONST_METHOD1(QueryApplicationType, void(AZ::ApplicationTypeQuery&));

+ 3 - 5
Code/Tools/SerializeContextTools/Converter.cpp

@@ -202,8 +202,6 @@ namespace AZ
             bool skipSystem = commandLine->HasSwitch("skipsystem");
             bool isDryRun = commandLine->HasSwitch("dryrun");
 
-            const char* appRoot = const_cast<const Application&>(application).GetAppRoot();
-
             PathDocumentContainer documents;
             bool result = true;
             const AZStd::string& filePath = application.GetConfigFilePath();
@@ -230,7 +228,7 @@ namespace AZ
             }
             
             auto callback = 
-                [&result, skipGems, skipSystem, &configurationName, sourceGameFolder, &appRoot, &documents, &convertSettings, &verifySettings]
+                [&result, skipGems, skipSystem, &configurationName, sourceGameFolder, &documents, &convertSettings, &verifySettings]
                 (void* classPtr, const Uuid& classId, SerializeContext* context)
             {
                 if (classId == azrtti_typeid<AZ::ComponentApplication::Descriptor>())
@@ -238,7 +236,7 @@ namespace AZ
                     if (!skipSystem)
                     {
                         result = ConvertSystemSettings(documents, *reinterpret_cast<AZ::ComponentApplication::Descriptor*>(classPtr), 
-                            configurationName, sourceGameFolder, appRoot) && result;
+                            configurationName, sourceGameFolder) && result;
                     }
 
                     // Cleanup the Serialized Element to allow any classes within the element's hierarchy to delete
@@ -443,7 +441,7 @@ namespace AZ
         }
 
         bool Converter::ConvertSystemSettings(PathDocumentContainer& documents, const ComponentApplication::Descriptor& descriptor, 
-            const AZStd::string& configurationName, const AZ::IO::PathView& projectFolder, [[maybe_unused]] const AZStd::string& applicationRoot)
+            const AZStd::string& configurationName, const AZ::IO::PathView& projectFolder)
         {
             AZ::IO::FixedMaxPath memoryFilePath{ projectFolder };
             memoryFilePath /= "Registry";

+ 1 - 1
Code/Tools/SerializeContextTools/Converter.h

@@ -43,7 +43,7 @@ namespace AZ
             using PathDocumentContainer = AZStd::vector<PathDocumentPair>;
 
             static bool ConvertSystemSettings(PathDocumentContainer& documents, const ComponentApplication::Descriptor& descriptor, 
-                const AZStd::string& configurationName, const AZ::IO::PathView& projectFolder, const AZStd::string& applicationRoot);
+                const AZStd::string& configurationName, const AZ::IO::PathView& projectFolder);
             static bool ConvertSystemComponents(PathDocumentContainer& documents, const Entity& entity,
                 const AZStd::string& configurationName, const AZ::IO::PathView& projectFolder,
                 const JsonSerializerSettings& convertSettings, const JsonDeserializerSettings& verifySettings);

+ 0 - 1
Gems/AWSClientAuth/Code/Tests/AWSClientAuthGemMock.h

@@ -608,7 +608,6 @@ namespace AWSClientAuthUnitTest
         AZ::Entity* FindEntity(const AZ::EntityId&) override { return nullptr; }
         AZ::BehaviorContext* GetBehaviorContext() override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         void EnumerateEntities(const EntityCallback& /*callback*/) override {}
         void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {}

+ 6 - 15
Gems/AssetValidation/Code/Source/AssetValidationSystemComponent.cpp

@@ -439,13 +439,6 @@ namespace AssetValidation
 
     bool GetDefaultSeedListFiles(AZStd::vector<AZStd::string>& defaultSeedListFiles)
     {
-        const char* engineRoot = nullptr;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-
-        const char* appRoot = nullptr;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
-
-
         auto settingsRegistry = AZ::SettingsRegistry::Get();
         AZ::SettingsRegistryInterface::FixedValueString gameFolder;
         auto projectKey = AZ::SettingsRegistryInterface::FixedValueString::format("%s/project_path", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey);
@@ -509,30 +502,28 @@ namespace AssetValidation
 
     AZ::Outcome<AzFramework::AssetSeedList, AZStd::string> AssetValidationSystemComponent::LoadSeedList(const char* seedPath, AZStd::string& seedListPath)
     {
-        AZStd::string absoluteSeedPath = seedPath;
+        AZ::IO::Path absoluteSeedPath = seedPath;
 
         if (AZ::StringFunc::Path::IsRelative(seedPath))
         {
-            const char* appRoot = nullptr;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
+            AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
 
-            if (!appRoot)
+            if (engineRoot.empty())
             {
                 return AZ::Failure(AZStd::string("Couldn't get engine root"));
             }
 
-            absoluteSeedPath = AZStd::string::format("%s/%s", appRoot, seedPath);
+            absoluteSeedPath = (engineRoot / seedPath).String();
         }
 
-        AzFramework::StringFunc::Path::Normalize(absoluteSeedPath);
         AzFramework::AssetSeedList seedList;
 
-        if (!AZ::Utils::LoadObjectFromFileInPlace(absoluteSeedPath, seedList))
+        if (!AZ::Utils::LoadObjectFromFileInPlace(absoluteSeedPath.Native(), seedList))
         {
             return AZ::Failure(AZStd::string::format("Failed to load seed list %s", absoluteSeedPath.c_str()));
         }
 
-        seedListPath = absoluteSeedPath;
+        seedListPath = AZStd::move(absoluteSeedPath.Native());
 
         return AZ::Success(seedList);
     }

+ 2 - 7
Gems/AssetValidation/Code/Tests/AssetValidationTestShared.h

@@ -150,13 +150,13 @@ struct AssetValidationTest
 
             auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
                 + "/project_path";
-            m_registry.Set(projectPathKey, (AZ::IO::FixedMaxPath(GetEngineRoot()) / "AutomatedTesting").Native());
+            m_registry.Set(projectPathKey, (AZ::IO::FixedMaxPath(m_tempDir.GetDirectory()) / "AutomatedTesting").Native());
             AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(m_registry);
 
             // Set the engine root to the temporary directory and re-update the runtime file paths
             auto enginePathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
                 + "/engine_path";
-            m_registry.Set(enginePathKey, GetEngineRoot());
+            m_registry.Set(enginePathKey, m_tempDir.GetDirectory());
             AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(m_registry);
         }
     }
@@ -176,11 +176,6 @@ struct AssetValidationTest
         AZ_Assert(false, "Not implemented");
     }
 
-    const char* GetEngineRoot() const override
-    {
-        return m_tempDir.GetDirectory();
-    }
-
     void SetUp() override
     {
         using namespace ::testing;

+ 0 - 1
Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp

@@ -111,7 +111,6 @@ namespace UnitTest
         AZ::SerializeContext* GetSerializeContext() override { return m_context.get(); }
         AZ::BehaviorContext*  GetBehaviorContext() override { return nullptr; }
         AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return m_jsonRegistrationContext.get(); }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
         void EnumerateEntities(const AZ::ComponentApplicationRequests::EntityCallback& /*callback*/) override {}

+ 4 - 5
Gems/Atom/Feature/Common/Code/Source/LuxCore/LuxCoreRenderer.cpp

@@ -13,6 +13,7 @@
 #include <AzCore/Component/TransformBus.h>
 #include <AzFramework/Components/CameraBus.h>
 #include <AzCore/std/containers/compressed_pair.h>
+#include <AzCore/Utils/Utils.h>
 #include <AzFramework/API/ApplicationAPI.h>
 
 #include <luxcore/luxcore.h>
@@ -295,14 +296,12 @@ namespace AZ
             }
 
             // Run luxcoreui.exe
-            AZStd::string luxCoreExeFullPath;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(luxCoreExeFullPath, &AzFramework::ApplicationRequests::GetAppRoot);
-            luxCoreExeFullPath = luxCoreExeFullPath + AZ_TRAIT_LUXCORE_EXEPATH;
-            AzFramework::StringFunc::Path::Normalize(luxCoreExeFullPath);
+            AZ::IO::FixedMaxPath luxCoreExeFullPath = AZ::Utils::GetEnginePath();
+            luxCoreExeFullPath /= AZ_TRAIT_LUXCORE_EXEPATH;
 
             AZStd::string commandLine = "-o " + AZStd::string(resolvedPath) + "/render.cfg";
 
-            LuxCoreUI::LaunchLuxCoreUI(luxCoreExeFullPath, commandLine);
+            LuxCoreUI::LaunchLuxCoreUI(luxCoreExeFullPath.String(), commandLine);
         }
     }
 }

+ 0 - 1
Gems/Atom/RPI/Code/Tests.Builders/BuilderTestFixture.h

@@ -46,7 +46,6 @@ namespace UnitTest
         bool DeleteEntity(const AZ::EntityId&) override { return false; }
         AZ::Entity* FindEntity(const AZ::EntityId&) override { return nullptr; }
         AZ::BehaviorContext*  GetBehaviorContext() override { return nullptr; }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
         void EnumerateEntities(const EntityCallback& /*callback*/) override {}

+ 0 - 1
Gems/Atom/RPI/Code/Tests/Common/AssetManagerTestFixture.h

@@ -44,7 +44,6 @@ namespace UnitTest
         AZ::Entity* FindEntity(const AZ::EntityId&) override { return nullptr; }
         AZ::BehaviorContext*  GetBehaviorContext() override { return nullptr; }
         AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
         void EnumerateEntities(const EntityCallback& /*callback*/) override {}

+ 5 - 22
Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/Util.cpp

@@ -133,29 +133,12 @@ namespace AtomToolsFramework
 
     bool LaunchTool(const QString& baseName, const QString& extension, const QStringList& arguments)
     {
-        const char* engineRoot = nullptr;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-        AZ_Assert(engineRoot != nullptr, "AzFramework::ApplicationRequests::GetEngineRoot failed");
+        AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
+        AZ_Assert(!engineRoot.empty(), "Cannot query Engine Path");
 
-        char binFolderName[AZ_MAX_PATH_LEN] = {};
-        AZ::Utils::GetExecutablePathReturnType ret = AZ::Utils::GetExecutablePath(binFolderName, AZ_MAX_PATH_LEN);
+        AZ::IO::FixedMaxPath launchPath = AZ::IO::FixedMaxPath(AZ::Utils::GetExecutableDirectory())
+            / (baseName + extension).toUtf8().constData();
 
-        // If it contains the filename, zero out the last path separator character...
-        if (ret.m_pathIncludesFilename)
-        {
-            char* lastSlash = strrchr(binFolderName, AZ_CORRECT_FILESYSTEM_SEPARATOR);
-            if (lastSlash)
-            {
-                *lastSlash = '\0';
-            }
-        }
-
-        const QString path = QString("%1%2%3%4")
-            .arg(binFolderName)
-            .arg(AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING)
-            .arg(baseName)
-            .arg(extension);
-
-        return QProcess::startDetached(path, arguments, engineRoot);
+        return QProcess::startDetached(launchPath.c_str(), arguments, engineRoot.c_str());
     }
 }

+ 4 - 5
Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiPassTree.inl

@@ -19,11 +19,11 @@
 
 #include <Atom/Utils/DdsFile.h>
 
-#include <AzFramework/API/ApplicationAPI.h>
 
 #include <AzCore/IO/GenericStreams.h>
 #include <AzCore/IO/SystemFile.h>
 #include <AzCore/IO/FileIO.h>
+#include <AzCore/Utils/Utils.h>
 
 #ifndef SCRIPTABLE_IMGUI
 #define Scriptable_ImGui ImGui
@@ -334,11 +334,10 @@ namespace AZ::Render
 
         if (m_engineRoot.empty())
         {
-            const char* engineRoot = nullptr;
-            AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-            if (engineRoot)
+            AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
+            if (!engineRoot.empty())
             {
-                m_engineRoot = AZStd::string(engineRoot);
+                m_engineRoot = AZStd::string_view(engineRoot);
             }
         }
 

+ 0 - 6
Gems/AudioSystem/Code/Source/Editor/ImplementationManager.cpp

@@ -9,8 +9,6 @@
 
 #include <ImplementationManager.h>
 
-#include <AzFramework/Application/Application.h>
-
 #include <ATLControlsModel.h>
 #include <AudioControlsEditorPlugin.h>
 #include <IAudioSystemEditor.h>
@@ -32,10 +30,6 @@ bool CImplementationManager::LoadImplementation()
         // release the loaded implementation (if any)
         Release();
 
-        const char* engineRoot = nullptr;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-        AZ_Assert(engineRoot != nullptr, "Unable to communicate with AzFramework::ApplicationRequests::Bus");
-
         AudioControlsEditor::EditorImplPluginEventBus::Broadcast(&AudioControlsEditor::EditorImplPluginEventBus::Events::InitializeEditorImplPlugin);
     }
     else

+ 2 - 3
Gems/EditorPythonBindings/Code/Source/PythonSystemComponent.cpp

@@ -597,11 +597,10 @@ namespace EditorPythonBindings
     {
         AZStd::unordered_set<AZStd::string> pyPackageSites(pythonPathStack.begin(), pythonPathStack.end());
 
-        const char* engineRoot = nullptr;
-        AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
+        AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
 
         // set PYTHON_HOME
-        AZStd::string pyBasePath = Platform::GetPythonHomePath(PY_PACKAGE, engineRoot);
+        AZStd::string pyBasePath = Platform::GetPythonHomePath(PY_PACKAGE, engineRoot.c_str());
         if (!AZ::IO::SystemFile::Exists(pyBasePath.c_str()))
         {
             AZ_Warning("python", false, "Python home path must exist! path:%s", pyBasePath.c_str());

+ 0 - 4
Gems/EditorPythonBindings/Code/Tests/PythonTestingUtility.h

@@ -135,10 +135,6 @@ namespace UnitTest
         void NormalizePath(AZStd::string& ) override {}
         void NormalizePathKeepCase(AZStd::string& ) override {}
         void CalculateBranchTokenForEngineRoot(AZStd::string& ) const override {}
-        // Gets the engine root path for testing
-        const char* GetEngineRoot() const override { return m_engineRoot.c_str(); }
-        // Retrieves the app root path for testing
-        const char* GetAppRoot() const override { return m_engineRoot.c_str(); }
 
         AZ::ComponentApplication m_app;
         AZStd::unique_ptr<FileIOHelper> m_fileIOHelper;

+ 0 - 1
Gems/LmbrCentral/Code/Tests/Builders/SliceBuilderTests.cpp

@@ -311,7 +311,6 @@ namespace UnitTest
         SerializeContext* GetSerializeContext() override { return m_serializeContext; }
         BehaviorContext* GetBehaviorContext() override { return nullptr; }
         JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
-        const char* GetAppRoot() const override { return nullptr; }
         const char* GetEngineRoot() const override { return nullptr; }
         const char* GetExecutableFolder() const override { return nullptr; }
         void EnumerateEntities(const EntityCallback& /*callback*/) override {}

+ 0 - 1
Gems/Multiplayer/Code/Tests/CommonBenchmarkSetup.h

@@ -41,7 +41,6 @@ namespace Multiplayer
         AZ::SerializeContext* GetSerializeContext() override { return {}; }
         AZ::BehaviorContext* GetBehaviorContext() override { return {}; }
         AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return {}; }
-        const char* GetAppRoot() const override { return {}; }
         const char* GetEngineRoot() const override { return {}; }
         const char* GetExecutableFolder() const override { return {}; }
         void QueryApplicationType([[maybe_unused]] AZ::ApplicationTypeQuery& appType) const override {}

+ 0 - 1
Gems/Multiplayer/Code/Tests/MockInterfaces.h

@@ -146,7 +146,6 @@ namespace UnitTest
         MOCK_METHOD0(GetSerializeContext, AZ::SerializeContext* ());
         MOCK_METHOD0(GetBehaviorContext, AZ::BehaviorContext* ());
         MOCK_METHOD0(GetJsonRegistrationContext, AZ::JsonRegistrationContext* ());
-        MOCK_CONST_METHOD0(GetAppRoot, const char* ());
         MOCK_CONST_METHOD0(GetEngineRoot, const char* ());
         MOCK_CONST_METHOD0(GetExecutableFolder, const char* ());
         MOCK_METHOD0(GetDrillerManager, AZ::Debug::DrillerManager* ());

+ 2 - 3
Gems/PhysX/Code/Source/Debug/PhysXDebug.cpp

@@ -13,7 +13,7 @@
 #include <AzFramework/StringFunc/StringFunc.h>
 #include <AzCore/std/string/conversions.h>
 #include <PxPhysicsAPI.h>
-#include <AzCore/Component/ComponentApplicationBus.h>
+#include <AzCore/Utils/Utils.h>
 
 namespace PhysX
 {
@@ -108,8 +108,7 @@ namespace PhysX
                     AzFramework::StringFunc::Append(filename, m_config.m_pvdConfigurationData.m_fileName.c_str());
                     AzFramework::StringFunc::Append(filename, ".pxd2");
 
-                    AZStd::string rootDirectory;
-                    AZ::ComponentApplicationBus::BroadcastResult(rootDirectory, &AZ::ComponentApplicationRequests::GetAppRoot);
+                    AZStd::string rootDirectory{ AZStd::string_view(AZ::Utils::GetEnginePath()) };
 
                     // Create the full filepath.
                     AZStd::string safeFilePath;

+ 0 - 1
Gems/ScriptCanvas/Code/Tests/ScriptCanvasBuilderTests.cpp

@@ -89,7 +89,6 @@ protected:
     AZ::SerializeContext* GetSerializeContext() override { return m_serializeContext; }
     AZ::BehaviorContext*  GetBehaviorContext() override { return nullptr; }
     AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
-    const char* GetAppRoot() const override { return nullptr; }
     const char* GetEngineRoot() const override { return nullptr; }
     const char* GetExecutableFolder() const override { return nullptr; }
     void EnumerateEntities(const AZ::ComponentApplicationRequests::EntityCallback& /*callback*/) override {}

+ 0 - 8
Gems/ScriptCanvasTesting/Code/Source/Framework/ScriptCanvasTestFixture.h

@@ -91,14 +91,6 @@ namespace ScriptCanvasTests
             AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
             AZ_Assert(fileIO, "SC unit tests require filehandling");
 
-            if (!fileIO->GetAlias("@engroot@"))
-            {
-                const char* engineRoot = nullptr;
-                AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
-                AZ_Assert(engineRoot, "null engine root");
-                fileIO->SetAlias("@engroot@", engineRoot);
-            }
-
             s_setupSucceeded = fileIO->GetAlias("@engroot@") != nullptr;
             
             AZ::TickBus::AllowFunctionQueuing(true);

+ 3 - 1
cmake/Projects.cmake

@@ -183,7 +183,9 @@ if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")
         cmake_path(GET gem_source_path_setreg FILENAME setreg_filename)
         list(APPEND artifacts_to_remove "${cache_product_path}/registry/${setreg_filename}")
     endforeach()
-    file(REMOVE ${artifacts_to_remove})
+    if (artifacts_to_remove)
+        file(REMOVE ${artifacts_to_remove})
+    endif()
 endif()
 ]=])