Commit 4b409aa4 authored by Ben Boeckel's avatar Ben Boeckel Committed by Ben Boeckel
Browse files

SystemTools: Take strings in SplitPath

Change-Id: Ic80a61bd1bb23f46b2b1875e672a4dc4f93cc7ce
parent 84db9ee5
...@@ -3307,7 +3307,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, ...@@ -3307,7 +3307,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn,
kwsys_stl::string & casePath) kwsys_stl::string & casePath)
{ {
kwsys_stl::vector<kwsys_stl::string> path_components; kwsys_stl::vector<kwsys_stl::string> path_components;
SystemTools::SplitPath(pathIn.c_str(), path_components); SystemTools::SplitPath(pathIn, path_components);
if(path_components[0].empty()) // First component always exists. if(path_components[0].empty()) // First component always exists.
{ {
// Relative paths cannot be converted. // Relative paths cannot be converted.
...@@ -3389,11 +3389,11 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p) ...@@ -3389,11 +3389,11 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* SystemTools::SplitPathRootComponent(const char* p, const char* SystemTools::SplitPathRootComponent(const std::string& p,
kwsys_stl::string* root) kwsys_stl::string* root)
{ {
// Identify the root component. // Identify the root component.
const char* c = p; const char* c = p.c_str();
if((c[0] == '/' && c[1] == '/') || (c[0] == '\\' && c[1] == '\\')) if((c[0] == '/' && c[1] == '/') || (c[0] == '\\' && c[1] == '\\'))
{ {
// Network path. // Network path.
...@@ -3475,17 +3475,17 @@ const char* SystemTools::SplitPathRootComponent(const char* p, ...@@ -3475,17 +3475,17 @@ const char* SystemTools::SplitPathRootComponent(const char* p,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void SystemTools::SplitPath(const char* p, void SystemTools::SplitPath(const std::string& p,
kwsys_stl::vector<kwsys_stl::string>& components, kwsys_stl::vector<kwsys_stl::string>& components,
bool expand_home_dir) bool expand_home_dir)
{ {
const char* c = p; const char* c;
components.clear(); components.clear();
// Identify the root component. // Identify the root component.
{ {
kwsys_stl::string root; kwsys_stl::string root;
c = SystemTools::SplitPathRootComponent(c, &root); c = SystemTools::SplitPathRootComponent(p, &root);
// Expand home directory references if requested. // Expand home directory references if requested.
if(expand_home_dir && !root.empty() && root[0] == '~') if(expand_home_dir && !root.empty() && root[0] == '~')
...@@ -3520,7 +3520,7 @@ void SystemTools::SplitPath(const char* p, ...@@ -3520,7 +3520,7 @@ void SystemTools::SplitPath(const char* p,
{ {
homedir.resize(homedir.size() - 1); homedir.resize(homedir.size() - 1);
} }
SystemTools::SplitPath(homedir.c_str(), components); SystemTools::SplitPath(homedir, components);
} }
else else
{ {
......
...@@ -383,7 +383,7 @@ public: ...@@ -383,7 +383,7 @@ public:
* returned. The root component is stored in the "root" string if * returned. The root component is stored in the "root" string if
* given. * given.
*/ */
static const char* SplitPathRootComponent(const char* p, static const char* SplitPathRootComponent(const std::string& p,
kwsys_stl::string* root=0); kwsys_stl::string* root=0);
/** /**
...@@ -396,7 +396,7 @@ public: ...@@ -396,7 +396,7 @@ public:
* automatically expanded if expand_home_dir is true and this * automatically expanded if expand_home_dir is true and this
* platform supports them. * platform supports them.
*/ */
static void SplitPath(const char* p, static void SplitPath(const std::string& p,
kwsys_stl::vector<kwsys_stl::string>& components, kwsys_stl::vector<kwsys_stl::string>& components,
bool expand_home_dir = true); bool expand_home_dir = true);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment