aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--butl/filesystem.cxx10
-rw-r--r--tests/wildcard/testscript13
2 files changed, 23 insertions, 0 deletions
diff --git a/butl/filesystem.cxx b/butl/filesystem.cxx
index e792bef..5135281 100644
--- a/butl/filesystem.cxx
+++ b/butl/filesystem.cxx
@@ -21,6 +21,8 @@
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# endif
+
+# include <butl/utility> // lcase()
#endif
#include <errno.h> // errno, E*
@@ -797,7 +799,11 @@ namespace butl
char pc;
for (; rpi != rpe && (pc = *rpi) != '*' && rni != rne; ++rpi, ++rni)
{
+#ifndef _WIN32
if (*rni != pc && pc != '?')
+#else
+ if (lcase (*rni) != lcase (pc) && pc != '?')
+#endif
return false;
}
@@ -832,7 +838,11 @@ namespace butl
//
for (; (pc = *pi) != '*' && ni != ne; ++pi, ++ni)
{
+#ifndef _WIN32
if (*ni != pc && pc != '?')
+#else
+ if (lcase (*ni) != lcase (pc) && pc != '?')
+#endif
return false;
}
diff --git a/tests/wildcard/testscript b/tests/wildcard/testscript
index bcd618f..4a6c532 100644
--- a/tests/wildcard/testscript
+++ b/tests/wildcard/testscript
@@ -74,6 +74,19 @@
}
}
}
+
+ : case-sensitivity
+ :
+ : Test that matching is case-insensitive on Windows and sensitive otherwise.
+ :
+ if ($cxx.target.class != 'windows')
+ {
+ $* F*O/ foo/ == 1
+ }
+ else
+ {
+ $* F*O/ foo/
+ }
}
: path-search