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.
main
Eric Phister 5 years ago committed by GitHub
parent 7c28b1ff86
commit 74491c88b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,6 +12,7 @@
#include "BuilderManager.h" #include "BuilderManager.h"
#include <AzCore/std/smart_ptr/make_shared.h> #include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/API/ApplicationAPI.h> #include <AzFramework/API/ApplicationAPI.h>
#include <native/connection/connectionManager.h> #include <native/connection/connectionManager.h>
@ -186,10 +187,9 @@ namespace AssetProcessor
QDir projectCacheRoot; QDir projectCacheRoot;
AssetUtilities::ComputeProjectCacheRoot(projectCacheRoot); AssetUtilities::ComputeProjectCacheRoot(projectCacheRoot);
QString gameName = AssetUtilities::ComputeProjectName(); AZ::SettingsRegistryInterface::FixedValueString projectName = AZ::Utils::GetProjectName();
QString projectPath = AssetUtilities::ComputeProjectPath(); AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
QDir engineRoot; AZ::IO::FixedMaxPathString enginePath = AZ::Utils::GetEnginePath();
AssetUtilities::ComputeEngineRoot(engineRoot);
int portNumber = 0; int portNumber = 0;
ApplicationServerBus::BroadcastResult(portNumber, &ApplicationServerBus::Events::GetServerListeningPort); ApplicationServerBus::BroadcastResult(portNumber, &ApplicationServerBus::Events::GetServerListeningPort);
@ -197,14 +197,14 @@ namespace AssetProcessor
AZStd::string params; AZStd::string params;
#if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS #if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
params = AZStd::string::format( 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, R"(-task=%s -id="%s" -project-name="%s" -project-cache-path="%s" -project-path="%s" -engine-path="%s" -port %d)",
builderGuid.c_str(), gameName.toUtf8().constData(), projectCacheRoot.absolutePath().toUtf8().constData(), task, builderGuid.c_str(), projectName.c_str(), projectCacheRoot.absolutePath().toUtf8().constData(),
projectPath.toUtf8().constData(), engineRoot.absolutePath().toUtf8().constData(), portNumber); projectPath.c_str(), enginePath.c_str(), portNumber);
#else #else
params = AZStd::string::format( params = AZStd::string::format(
R"(-task=%s -id="%s" -project-name="\"%s\"" -project-cache-path="\"%s\"" -project-path="\"%s\"" -engine-path="\"%s\"" -port %d)", 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(), task, builderGuid.c_str(), projectName.c_str(), projectCacheRoot.absolutePath().toUtf8().constData(),
projectPath.toUtf8().constData(), engineRoot.absolutePath().toUtf8().constData(), portNumber); projectPath.c_str(), enginePath.c_str(), portNumber);
#endif // !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS #endif // !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
if (moduleFilePath && moduleFilePath[0]) if (moduleFilePath && moduleFilePath[0])

Loading…
Cancel
Save