From 986519af42c813b5bd9a147e48de1d61e136c610 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Wed, 8 Apr 2020 15:26:25 -0400
Subject: [PATCH] SystemTools: handle splitting a string starting with the
 separator

If a string started with the separator, the first component would have
the separator included in it.
---
 SystemTools.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SystemTools.cxx b/SystemTools.cxx
index 8ec30580..3a6ceec9 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -1904,7 +1904,7 @@ std::vector<std::string> SystemTools::SplitString(const std::string& p,
     paths.emplace_back("/");
   }
   std::string::size_type pos1 = 0;
-  std::string::size_type pos2 = path.find(sep, pos1 + 1);
+  std::string::size_type pos2 = path.find(sep, pos1);
   while (pos2 != std::string::npos) {
     paths.push_back(path.substr(pos1, pos2 - pos1));
     pos1 = pos2 + 1;
-- 
GitLab