summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-21 15:29:29 -0400
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-21 15:29:29 -0400
commit2d513c2364fde09919526257929b794cfff6e08f (patch)
tree49f6c598ccb6325e8848dc76866ec742abd5ddfe
parentd4042b46d1f6c41aeaf3ed88ef0e74f2b22b43ab (diff)
downloadcmake-2d513c2364fde09919526257929b794cfff6e08f.tar.gz
ENH: fix glob on windows and add glob recurse test
-rw-r--r--Source/cmGlob.cxx25
-rw-r--r--Tests/StringFileTest/CMakeLists.txt2
2 files changed, 25 insertions, 2 deletions
diff --git a/Source/cmGlob.cxx b/Source/cmGlob.cxx
index 136673f205..466f9c6025 100644
--- a/Source/cmGlob.cxx
+++ b/Source/cmGlob.cxx
@@ -205,6 +205,7 @@ void cmGlob::ProcessDirectory(std::string::size_type start,
{
continue;
}
+
if ( m_Internals->Expressions[start].find(d.GetFile(cc)) )
{
if ( last )
@@ -233,6 +234,10 @@ bool cmGlob::FindFiles(const std::string& inexpr)
expr = cmsys::SystemTools::GetCurrentWorkingDirectory();
expr += "/" + inexpr;
}
+ if ( expr[1] == ':' && expr[0] != '/' )
+ {
+ expr = expr.substr(2);
+ }
for ( cc = 0; cc < expr.size(); cc ++ )
{
int ch = expr[cc];
@@ -253,8 +258,24 @@ bool cmGlob::FindFiles(const std::string& inexpr)
{
this->AddExpression(cexpr.c_str());
}
-
- this->ProcessDirectory(0, "/", true);
+ if ( inexpr[1] == ':' && inexpr[0] != '/' )
+ {
+ std::string startdir = "A:/";
+ if ( inexpr[0] >= 'a' && inexpr[0] <= 'z' ||
+ inexpr[0] >= 'A' && inexpr[0] <= 'Z')
+ {
+ startdir[0] = inexpr[0];
+ this->ProcessDirectory(0, startdir, true);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ this->ProcessDirectory(0, "/", true);
+ }
return true;
}
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index 2af415a435..f581f0a50a 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -60,6 +60,8 @@ STRING(REGEX REPLACE "includefile" "${file}" outfile "${infile}")
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h" "${outfile}")
# Test file glob
+FILE(GLOB_RECURSE src_files "${CMAKE_CURRENT_SOURCE_DIR}/*")
+MESSAGE(STATUS "Files in ${CMAKE_CURRENT_SOURCE_DIR} are ${src_files}")
FILE(GLOB src_files "${CMAKE_CURRENT_SOURCE_DIR}/[sS][!a-su-zA-Z0-9][^a-qs-zA-Z0-9]ing?ile*.cxx")
ADD_EXECUTABLE(StringFileTest ${src_files})