From f0fc906510078c8c1dac450d1f888384a64d8e0f Mon Sep 17 00:00:00 2001 From: amzn-phist <52085794+amzn-phist@users.noreply.github.com> Date: Wed, 1 Sep 2021 10:23:47 -0500 Subject: [PATCH] Misc fixes for Linux SDK (#3764) * Fix rpath for lrelease binary This fixes the rpath for lrelease which is used to compile the qt translation file. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fix a LocalFileIO path casing issue LocalFileIO was lowercasing the entire path after substituting aliases. This caused files to not be found and many failures in AP. Fixed to only lowercase the trailing relative path after the substitution. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Removed a message line Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> --- Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp | 6 +++++- cmake/Platform/Linux/Install_linux.cmake | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp index aca7a41950..55e4f06db0 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp @@ -707,6 +707,7 @@ namespace AZ resolvedPathLen += postAliasView.size(); // Null-Terminated the resolved path resolvedPath[resolvedPathLen] = '\0'; + // If the path started with one of the "asset cache" path aliases, lowercase the path const char* assetAliasPath = GetAlias("@assets@"); const char* rootAliasPath = GetAlias("@root@"); @@ -714,10 +715,13 @@ namespace AZ const bool lowercasePath = (assetAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, assetAliasPath)) || (rootAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, rootAliasPath)) || (projectPlatformCacheAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, projectPlatformCacheAliasPath)); + if (lowercasePath) { - AZStd::to_lower(resolvedPath, resolvedPath + resolvedPathLen); + // Lowercase only the relative part after the replaced alias. + AZStd::to_lower(resolvedPath + aliasValue.size(), resolvedPath + resolvedPathLen); } + // Replace any backslashes with posix slashes AZStd::replace(resolvedPath, resolvedPath + resolvedPathLen, AZ::IO::WindowsPathSeparator, AZ::IO::PosixPathSeparator); return true; diff --git a/cmake/Platform/Linux/Install_linux.cmake b/cmake/Platform/Linux/Install_linux.cmake index b3e2093b65..87713fa5d6 100644 --- a/cmake/Platform/Linux/Install_linux.cmake +++ b/cmake/Platform/Linux/Install_linux.cmake @@ -14,6 +14,9 @@ function(ly_copy source_file target_directory) if("${source_file}" MATCHES "qt/plugins" AND "${target_filename_ext}" STREQUAL ".so") get_filename_component(target_filename "${source_file}" NAME) file(RPATH_CHANGE FILE "${target_directory}/${target_filename}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..") + elseif("${source_file}" MATCHES "lrelease") + get_filename_component(target_filename "${source_file}" NAME) + file(RPATH_CHANGE FILE "${target_directory}/${target_filename}" OLD_RPATH "\$ORIGIN/../lib" NEW_RPATH "\$ORIGIN") endif() endfunction()]])