From 1c6c2bae285ecce518d68f708729840df9c28fb0 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 31 Jan 2019 16:58:49 +0100 Subject: cmake-server: Normalize build and source directories Fixes: #18862 --- Source/cmServerProtocol.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index c3c8156..203ee93 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -222,13 +222,22 @@ bool cmServerProtocol1::DoActivate(const cmServerRequest& request, std::string* errorMessage) { std::string sourceDirectory = request.Data[kSOURCE_DIRECTORY_KEY].asString(); - const std::string buildDirectory = - request.Data[kBUILD_DIRECTORY_KEY].asString(); + std::string buildDirectory = request.Data[kBUILD_DIRECTORY_KEY].asString(); std::string generator = request.Data[kGENERATOR_KEY].asString(); std::string extraGenerator = request.Data[kEXTRA_GENERATOR_KEY].asString(); std::string toolset = request.Data[kTOOLSET_KEY].asString(); std::string platform = request.Data[kPLATFORM_KEY].asString(); + // normalize source and build directory + if (!sourceDirectory.empty()) { + sourceDirectory = cmSystemTools::CollapseFullPath(sourceDirectory); + cmSystemTools::ConvertToUnixSlashes(sourceDirectory); + } + if (!buildDirectory.empty()) { + buildDirectory = cmSystemTools::CollapseFullPath(buildDirectory); + cmSystemTools::ConvertToUnixSlashes(buildDirectory); + } + if (buildDirectory.empty()) { setErrorMessage(errorMessage, std::string("\"") + kBUILD_DIRECTORY_KEY + -- cgit v0.12