summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-09-15 18:08:09 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-09-15 18:08:09 (GMT)
commitf545c5149fbc2034ca057cbb8a6e0823797a6c2c (patch)
treebf2415be2ae10ed1bc821e0979a7c2dc9de6a477
parentdf82ea0ad0bb2501fbc6e53396716f9329ca8a74 (diff)
downloadCMake-f545c5149fbc2034ca057cbb8a6e0823797a6c2c.zip
CMake-f545c5149fbc2034ca057cbb8a6e0823797a6c2c.tar.gz
CMake-f545c5149fbc2034ca057cbb8a6e0823797a6c2c.tar.bz2
ENH: Remove double slash
-rw-r--r--Source/cmGlob.cxx26
-rw-r--r--Source/cmGlob.h3
2 files changed, 23 insertions, 6 deletions
diff --git a/Source/cmGlob.cxx b/Source/cmGlob.cxx
index 613bc3c..bc1c2c1 100644
--- a/Source/cmGlob.cxx
+++ b/Source/cmGlob.cxx
@@ -154,7 +154,8 @@ std::string cmGlob::ConvertExpression(const std::string& expr)
return res + "$";
}
-void cmGlob::RecurseDirectory(const std::string& dir, bool dir_only)
+void cmGlob::RecurseDirectory(std::string::size_type start,
+ const std::string& dir, bool dir_only)
{
cmsys::Directory d;
if ( !d.Load(dir.c_str()) )
@@ -174,14 +175,29 @@ void cmGlob::RecurseDirectory(const std::string& dir, bool dir_only)
continue;
}
- realname = dir + "/" + fname;
+ if ( start == 0 )
+ {
+ realname = dir + fname;
+ }
+ else
+ {
+ realname = dir + "/" + fname;
+ }
#if defined( CM_GLOB_CASE_INDEPENDENT )
// On Windows and apple, no difference between lower and upper case
fname = cmsys::SystemTools::LowerCase(fname);
#endif
- fullname = dir + "/" + fname;
+ if ( start == 0 )
+ {
+ fullname = dir + fname;
+ }
+ else
+ {
+ fullname = dir + "/" + fname;
+ }
+
if ( !dir_only || !cmsys::SystemTools::FileIsDirectory(realname.c_str()) )
{
if ( m_Internals->Expressions[m_Internals->Expressions.size()-1].find(fname.c_str()) )
@@ -191,7 +207,7 @@ void cmGlob::RecurseDirectory(const std::string& dir, bool dir_only)
}
if ( cmsys::SystemTools::FileIsDirectory(realname.c_str()) )
{
- this->RecurseDirectory(realname, dir_only);
+ this->RecurseDirectory(start+1, realname, dir_only);
}
}
}
@@ -203,7 +219,7 @@ void cmGlob::ProcessDirectory(std::string::size_type start,
bool last = ( start == m_Internals->Expressions.size()-1 );
if ( last && m_Recurse )
{
- this->RecurseDirectory(dir, dir_only);
+ this->RecurseDirectory(start, dir, dir_only);
return;
}
cmsys::Directory d;
diff --git a/Source/cmGlob.h b/Source/cmGlob.h
index 125cd73..62e9d94 100644
--- a/Source/cmGlob.h
+++ b/Source/cmGlob.h
@@ -51,7 +51,8 @@ protected:
//! Process last directory, but only when recurse flags is on. That is
// effectively like saying: /path/to/file/**/file
- void RecurseDirectory(const std::string& dir, bool dir_only);
+ void RecurseDirectory(std::string::size_type start,
+ const std::string& dir, bool dir_only);
//! Escape all non-alphanumeric characters in pattern.
void Escape(int ch, char* buffer);