From a32758782c953a333c0dd1e8553aee66a4404ee5 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Fri, 9 Jun 2017 10:36:15 -0400 Subject: KWSys 2017-06-09 (a700e2ab) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit a700e2ab06e2741e4955a1aa120293bf78b8fcac (master). Upstream Shortlog ----------------- Brad King (1): 7e04a3d2 SystemTools: Remove RemoveEmptyPathElements method --- SystemTools.cxx | 11 ----------- SystemTools.hxx.in | 12 ++++++++---- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 1c4fe33..c5bbd41 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -22,7 +22,6 @@ #include KWSYS_HEADER(FStream.hxx) #include KWSYS_HEADER(Encoding.hxx) -#include #include #include #include @@ -3709,16 +3708,6 @@ std::string SystemTools::JoinPath( return result; } -void SystemTools::RemoveEmptyPathElements(std::vector& path) -{ - if (path.empty()) { - return; - } - - path.erase(std::remove(path.begin() + 1, path.end(), std::string("")), - path.end()); -} - bool SystemTools::ComparePath(const std::string& c1, const std::string& c2) { #if defined(_WIN32) || defined(__APPLE__) diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 5e091c2..1672e92 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -461,6 +461,10 @@ public: * produce the original path. Home directory references are * automatically expanded if expand_home_dir is true and this * platform supports them. + * + * This does *not* normalize the input path. All components are + * preserved, including empty ones. Typically callers should use + * this only on paths that have already been normalized. */ static void SplitPath(const std::string& p, std::vector& components, @@ -469,15 +473,15 @@ public: /** * Join components of a path name into a single string. See * SplitPath for the format of the components. + * + * This does *not* normalize the input path. All components are + * preserved, including empty ones. Typically callers should use + * this only on paths that have already been normalized. */ static std::string JoinPath(const std::vector& components); static std::string JoinPath(std::vector::const_iterator first, std::vector::const_iterator last); - /** Removes empty components from path. - */ - static void RemoveEmptyPathElements(std::vector& path); - /** * Compare a path or components of a path. */ -- cgit v0.12