|
|
|
|
@ -10,6 +10,8 @@
|
|
|
|
|
#include <AzCore/IO/SystemFile.h>
|
|
|
|
|
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
|
|
|
|
|
|
|
|
|
#include <AzFramework/Process/ProcessWatcher.h>
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
@ -24,14 +26,20 @@ namespace AzFramework::AssetSystem::Platform
|
|
|
|
|
AZ::IO::FixedMaxPath assetProcessorPath{ executableDirectory };
|
|
|
|
|
// In Mac the Editor and game is within a bundle, so the path to the sibling app
|
|
|
|
|
// has to go up from the Contents/MacOS folder the binary is in
|
|
|
|
|
assetProcessorPath /= "../../../AssetProcessor.app";
|
|
|
|
|
assetProcessorPath /= "../../../AssetProcessor.app/Contents/MacOS/AssetProcessor";
|
|
|
|
|
assetProcessorPath = assetProcessorPath.LexicallyNormal();
|
|
|
|
|
|
|
|
|
|
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
|
|
|
|
|
{
|
|
|
|
|
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
|
|
|
|
|
{
|
|
|
|
|
if (AZ::IO::FixedMaxPath installedBinariesPath;
|
|
|
|
|
settingsRegistry->Get(installedBinariesPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_InstalledBinaryFolder))
|
|
|
|
|
{
|
|
|
|
|
// Check for existence of one under a "bin" directory, i.e. engineRoot is an SDK structure.
|
|
|
|
|
assetProcessorPath =
|
|
|
|
|
AZ::IO::FixedMaxPath{engineRoot} / "bin" / AZ_TRAIT_OS_PLATFORM_NAME / AZ_BUILD_CONFIGURATION_TYPE / "AssetProcessor.app";
|
|
|
|
|
assetProcessorPath = AZ::IO::FixedMaxPath{ engineRoot } / installedBinariesPath / "AssetProcessor.app/Contents/MacOS/AssetProcessor";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
|
|
|
|
|
{
|
|
|
|
|
@ -39,23 +47,21 @@ namespace AzFramework::AssetSystem::Platform
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto fullLaunchCommand = AZ::IO::FixedMaxPathString::format(R"(open -g "%s" --args --start-hidden)", assetProcessorPath.c_str());
|
|
|
|
|
AZStd::string commandLineParams;
|
|
|
|
|
// Add the engine path to the launch command if not empty
|
|
|
|
|
if (!engineRoot.empty())
|
|
|
|
|
{
|
|
|
|
|
fullLaunchCommand += R"( --engine-path=")";
|
|
|
|
|
fullLaunchCommand += engineRoot;
|
|
|
|
|
fullLaunchCommand += '"';
|
|
|
|
|
commandLineParams += AZStd::string::format("\"--engine-path=\"%s\"\"", engineRoot.data());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add the active project path to the launch command if not empty
|
|
|
|
|
if (!projectPath.empty())
|
|
|
|
|
{
|
|
|
|
|
fullLaunchCommand += R"( --project-path=")";
|
|
|
|
|
fullLaunchCommand += projectPath;
|
|
|
|
|
fullLaunchCommand += '"';
|
|
|
|
|
commandLineParams += AZStd::string::format(" \"--regset=/Amazon/AzCore/Bootstrap/project_path=\"%s\"\"", projectPath.data());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return system(fullLaunchCommand.c_str()) == 0;
|
|
|
|
|
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
|
|
|
|
|
processLaunchInfo.m_processExecutableString = AZStd::move(assetProcessorPath.Native());
|
|
|
|
|
processLaunchInfo.m_commandlineParameters = commandLineParams;
|
|
|
|
|
return AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|