From c2145a63877e0606e0dd534b8fd4da01cdc00256 Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Mon, 22 Nov 2021 08:31:12 -0800 Subject: [PATCH] Use QStringList to avoid false matches against a partial path Signed-off-by: AMZN-Phil --- Code/Tools/ProjectManager/Platform/Mac/ProjectUtils_mac.cpp | 3 ++- .../ProjectManager/Platform/Windows/ProjectUtils_windows.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Code/Tools/ProjectManager/Platform/Mac/ProjectUtils_mac.cpp b/Code/Tools/ProjectManager/Platform/Mac/ProjectUtils_mac.cpp index 430e8974b7..0c232d44d1 100644 --- a/Code/Tools/ProjectManager/Platform/Mac/ProjectUtils_mac.cpp +++ b/Code/Tools/ProjectManager/Platform/Mac/ProjectUtils_mac.cpp @@ -25,7 +25,8 @@ namespace O3DE::ProjectManager // Add that path for the command line process so that it will be able to locate // a home-brew installed version of CMake QString pathEnv = qEnvironmentVariable("PATH"); - if (!pathEnv.contains("/usr/local/bin")) + QStringList pathEnvList = pathEnv.split(":"); + if (!pathEnvList.contains("/usr/local/bin")) { pathEnv += ":/usr/local/bin"; qputenv("PATH", pathEnv.toStdString().c_str()); diff --git a/Code/Tools/ProjectManager/Platform/Windows/ProjectUtils_windows.cpp b/Code/Tools/ProjectManager/Platform/Windows/ProjectUtils_windows.cpp index 365aac7069..92863b955c 100644 --- a/Code/Tools/ProjectManager/Platform/Windows/ProjectUtils_windows.cpp +++ b/Code/Tools/ProjectManager/Platform/Windows/ProjectUtils_windows.cpp @@ -37,7 +37,8 @@ namespace O3DE::ProjectManager QDir cmakePath(engineInfo.m_path); cmakePath.cd("cmake/runtime/bin"); QString pathEnv = qEnvironmentVariable("Path"); - if (!pathEnv.contains(cmakePath.path())) + QStringList pathEnvList = pathEnv.split(";"); + if (!pathEnvList.contains(cmakePath.path())) { pathEnv += ";" + cmakePath.path(); qputenv("Path", pathEnv.toStdString().c_str());