Skip to content

Commit

Permalink
harmonise path slashes ref #14134
Browse files Browse the repository at this point in the history
Signed-off-by: m-kro <[email protected]>
  • Loading branch information
m-kro committed Dec 11, 2023
1 parent 1475ab2 commit af3e65b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/netedit/tools/GNENetDiffTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/netedit/tools/GNEPythonTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/netedit/tools/GNERunNetgenerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit af3e65b

Please sign in to comment.