summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-23 14:26:37 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-23 14:26:37 (GMT)
commit8d22e9f70a1653fc6620cc8b5389d1036ec27596 (patch)
treeb0cc185b0dedbcc5d1c6339130b9c819a9dc6951 /Source
parentd4289ee2a98e616a6f4d50e21f05bedd9d83da63 (diff)
downloadCMake-8d22e9f70a1653fc6620cc8b5389d1036ec27596.zip
CMake-8d22e9f70a1653fc6620cc8b5389d1036ec27596.tar.gz
CMake-8d22e9f70a1653fc6620cc8b5389d1036ec27596.tar.bz2
ENH: On windows and apple handle lowercase/upercase file name problem
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlob.cxx40
1 files changed, 31 insertions, 9 deletions
diff --git a/Source/cmGlob.cxx b/Source/cmGlob.cxx
index 466f9c6..4e07eff 100644
--- a/Source/cmGlob.cxx
+++ b/Source/cmGlob.cxx
@@ -21,6 +21,7 @@
#include <cmsys/SystemTools.hxx>
#include <stdio.h>
+#include <ctype.h>
class cmGlobInternal
{
@@ -51,7 +52,12 @@ void cmGlob::Escape(int ch, char* buffer)
}
else
{
+#if defined( _WIN32 ) || defined(APPLE)
+ // On Windows and apple, no difference between lower and upper case
+ sprintf(buffer, "%c", tolower(ch));
+#else
sprintf(buffer, "%c", ch);
+#endif
}
}
@@ -147,17 +153,25 @@ void cmGlob::RecurseDirectory(const std::string& dir, bool dir_only)
}
unsigned long cc;
std::string fullname;
+ std::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{
- if ( strcmp(d.GetFile(cc), ".") == 0 ||
- strcmp(d.GetFile(cc), "..") == 0 )
+ fname = d.GetFile(cc);
+ if ( strcmp(fname.c_str(), ".") == 0 ||
+ strcmp(fname.c_str(), "..") == 0 )
{
continue;
}
- fullname = dir + "/" + d.GetFile(cc);
+
+#if defined( _WIN32 ) || defined( APPLE )
+ // On Windows and apple, no difference between lower and upper case
+ fname = cmsys::SystemTools::LowerCase(fname);
+#endif
+
+ fullname = dir + "/" + fname;
if ( !dir_only || !cmsys::SystemTools::FileIsDirectory(fullname.c_str()) )
{
- if ( m_Internals->Expressions[m_Internals->Expressions.size()-1].find(d.GetFile(cc)) )
+ if ( m_Internals->Expressions[m_Internals->Expressions.size()-1].find(fname.c_str()) )
{
m_Internals->Files.push_back(fullname);
}
@@ -185,20 +199,28 @@ void cmGlob::ProcessDirectory(std::string::size_type start,
}
unsigned long cc;
std::string fullname;
+ std::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{
- if ( strcmp(d.GetFile(cc), ".") == 0 ||
- strcmp(d.GetFile(cc), "..") == 0 )
+ fname = d.GetFile(cc);
+ if ( strcmp(fname.c_str(), ".") == 0 ||
+ strcmp(fname.c_str(), "..") == 0 )
{
continue;
}
+
+#if defined( _WIN32 ) || defined( APPLE )
+ // On Windows and apple, no difference between lower and upper case
+ fname = cmsys::SystemTools::LowerCase(fname);
+#endif
+
if ( start == 0 )
{
- fullname = dir + d.GetFile(cc);
+ fullname = dir + fname;
}
else
{
- fullname = dir + "/" + d.GetFile(cc);
+ fullname = dir + "/" + fname;
}
if ( (!dir_only || !last) && !cmsys::SystemTools::FileIsDirectory(fullname.c_str()) )
@@ -206,7 +228,7 @@ void cmGlob::ProcessDirectory(std::string::size_type start,
continue;
}
- if ( m_Internals->Expressions[start].find(d.GetFile(cc)) )
+ if ( m_Internals->Expressions[start].find(fname.c_str()) )
{
if ( last )
{