aboutsummaryrefslogtreecommitdiff
path: root/common/str.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/str.cpp')
-rw-r--r--common/str.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/common/str.cpp b/common/str.cpp
index d3522a665a..10d258e058 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -330,12 +330,12 @@ bool String::contains(char x) const {
return strchr(c_str(), x) != NULL;
}
-bool String::matchString(const char *pat) const {
- return Common::matchString(c_str(), pat);
+bool String::matchString(const char *pat, bool pathMode) const {
+ return Common::matchString(c_str(), pat, pathMode);
}
-bool String::matchString(const String &pat) const {
- return Common::matchString(c_str(), pat.c_str());
+bool String::matchString(const String &pat, bool pathMode) const {
+ return Common::matchString(c_str(), pat.c_str(), pathMode);
}
void String::deleteLastChar() {
@@ -615,7 +615,7 @@ Common::String normalizePath(const Common::String &path, const char sep) {
return result;
}
-bool matchString(const char *str, const char *pat) {
+bool matchString(const char *str, const char *pat, bool pathMode) {
assert(str);
assert(pat);
@@ -623,6 +623,13 @@ bool matchString(const char *str, const char *pat) {
const char *q = 0;
for (;;) {
+ if (pathMode && *str == '/') {
+ p = 0;
+ q = 0;
+ if (*pat == '?')
+ return false;
+ }
+
switch (*pat) {
case '*':
// Record pattern / string possition for backtracking