From af3e65be2e36388f53a574aca7024df58b948e47 Mon Sep 17 00:00:00 2001 From: m-kro Date: Mon, 11 Dec 2023 16:10:42 +0100 Subject: [PATCH] harmonise path slashes ref #14134 Signed-off-by: m-kro --- src/netedit/tools/GNENetDiffTool.cpp | 4 ++++ src/netedit/tools/GNEPythonTool.cpp | 4 ++++ src/netedit/tools/GNERunNetgenerate.cpp | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/netedit/tools/GNENetDiffTool.cpp b/src/netedit/tools/GNENetDiffTool.cpp index 7efd9fc295a7..12742ce4248d 100644 --- a/src/netedit/tools/GNENetDiffTool.cpp +++ b/src/netedit/tools/GNENetDiffTool.cpp @@ -96,6 +96,10 @@ GNENetDiffTool::getCommand() const { std::string sumoHome = ""; if (sumoHomeEnv != nullptr && sumoHomeEnv != std::string("")) { sumoHome = std::string(sumoHomeEnv); + // harmonise slash + if (sumoHome.back() == '\\') { + sumoHome = sumoHome.substr(0, sumoHome.size() - 1); + } // quote string to handle spaces but prevent double quotes if (sumoHome.front() != '"') { sumoHome = "\"" + sumoHome; diff --git a/src/netedit/tools/GNEPythonTool.cpp b/src/netedit/tools/GNEPythonTool.cpp index 43c86bd7f795..ecf802df576c 100644 --- a/src/netedit/tools/GNEPythonTool.cpp +++ b/src/netedit/tools/GNEPythonTool.cpp @@ -103,6 +103,10 @@ GNEPythonTool::getCommand() const { std::string sumoHome = ""; if (sumoHomeEnv != nullptr && sumoHomeEnv != std::string("")) { sumoHome = std::string(sumoHomeEnv); + // harmonise slash + if (sumoHome.back() == '\\') { + sumoHome = sumoHome.substr(0, sumoHome.size() - 1); + } // quote string to handle spaces but prevent double quotes if (sumoHome.front() != '"') { sumoHome = "\"" + sumoHome; diff --git a/src/netedit/tools/GNERunNetgenerate.cpp b/src/netedit/tools/GNERunNetgenerate.cpp index 1f3490174a20..d7e3ac9f0225 100644 --- a/src/netedit/tools/GNERunNetgenerate.cpp +++ b/src/netedit/tools/GNERunNetgenerate.cpp @@ -52,6 +52,10 @@ GNERunNetgenerate::run(const OptionsCont* netgenerateOptions) { std::string sumoHome = ""; if (sumoHomeEnv != nullptr && sumoHomeEnv != std::string("")) { sumoHome = std::string(sumoHomeEnv); + // harmonise slash + if (sumoHome.back() == '\\') { + sumoHome = sumoHome.substr(0, sumoHome.size() - 1); + } // prevent double quotes if (sumoHome.front() == '"') { sumoHome.erase(sumoHome.begin());