From 74491c88b88145590b0c4e947111f60f8729d7d2 Mon Sep 17 00:00:00 2001 From: Eric Phister <52085794+amzn-phist@users.noreply.github.com> Date: Tue, 15 Jun 2021 17:50:40 -0500 Subject: [PATCH] Fix AssetBuilders when project-path has a trailing slash (#1345) * Fixes issues with project paths w/ trailing slash When launching AP with a --project-path that has a trailing slash, the AssetBuilders would get that slash instead of a normalized version. This would mess up the params sent to AssetBuilders. * Missed a variable name replacement * Addresses feedback on code style guidelines Removed 'auto' keyword in favor of explicit types. --- .../native/utilities/BuilderManager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Code/Tools/AssetProcessor/native/utilities/BuilderManager.cpp b/Code/Tools/AssetProcessor/native/utilities/BuilderManager.cpp index 68ed75ebfb..d59569660b 100644 --- a/Code/Tools/AssetProcessor/native/utilities/BuilderManager.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/BuilderManager.cpp @@ -12,6 +12,7 @@ #include "BuilderManager.h" #include +#include #include #include @@ -186,10 +187,9 @@ namespace AssetProcessor QDir projectCacheRoot; AssetUtilities::ComputeProjectCacheRoot(projectCacheRoot); - QString gameName = AssetUtilities::ComputeProjectName(); - QString projectPath = AssetUtilities::ComputeProjectPath(); - QDir engineRoot; - AssetUtilities::ComputeEngineRoot(engineRoot); + AZ::SettingsRegistryInterface::FixedValueString projectName = AZ::Utils::GetProjectName(); + AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath(); + AZ::IO::FixedMaxPathString enginePath = AZ::Utils::GetEnginePath(); int portNumber = 0; ApplicationServerBus::BroadcastResult(portNumber, &ApplicationServerBus::Events::GetServerListeningPort); @@ -197,14 +197,14 @@ namespace AssetProcessor AZStd::string params; #if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS params = AZStd::string::format( - R"(-task=%s -id="%s" -project-name="%s" -project-cache-path="%s" -project-path="%s" -engine-path="%s" -port %d)", task, - builderGuid.c_str(), gameName.toUtf8().constData(), projectCacheRoot.absolutePath().toUtf8().constData(), - projectPath.toUtf8().constData(), engineRoot.absolutePath().toUtf8().constData(), portNumber); + R"(-task=%s -id="%s" -project-name="%s" -project-cache-path="%s" -project-path="%s" -engine-path="%s" -port %d)", + task, builderGuid.c_str(), projectName.c_str(), projectCacheRoot.absolutePath().toUtf8().constData(), + projectPath.c_str(), enginePath.c_str(), portNumber); #else params = AZStd::string::format( R"(-task=%s -id="%s" -project-name="\"%s\"" -project-cache-path="\"%s\"" -project-path="\"%s\"" -engine-path="\"%s\"" -port %d)", - task, builderGuid.c_str(), gameName.toUtf8().constData(), projectCacheRoot.absolutePath().toUtf8().constData(), - projectPath.toUtf8().constData(), engineRoot.absolutePath().toUtf8().constData(), portNumber); + task, builderGuid.c_str(), projectName.c_str(), projectCacheRoot.absolutePath().toUtf8().constData(), + projectPath.c_str(), enginePath.c_str(), portNumber); #endif // !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS if (moduleFilePath && moduleFilePath[0])