Skip to content
Snippets Groups Projects
Commit 24917524 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'SystemTools-RemoveEmptyPathElements'


6173f4b3 SystemTools: Add function to remove empty path components

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !37
parents 160bed45 6173f4b3
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
#include KWSYS_HEADER(FStream.hxx)
#include KWSYS_HEADER(Encoding.hxx)
#include <algorithm>
#include <fstream>
#include <iostream>
#include <set>
......@@ -3708,6 +3709,16 @@ std::string SystemTools::JoinPath(
return result;
}
void SystemTools::RemoveEmptyPathElements(std::vector<std::string>& 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__)
......
......@@ -474,6 +474,10 @@ public:
static std::string JoinPath(std::vector<std::string>::const_iterator first,
std::vector<std::string>::const_iterator last);
/** Removes empty components from path.
*/
static void RemoveEmptyPathElements(std::vector<std::string>& path);
/**
* Compare a path or components of a path.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment