Skip to content

Commit be2e5d4

Browse files
committed
Fixed wildcards when matching paths.
Signed-off-by: Filip Strömbäck <fstromback@gmail.com>
1 parent 934c263 commit be2e5d4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ The following options are pre-defined by mymake or the default configuration:
198198
- `windows`: Defined when running on a windows system, expected to be using `cl.exe` as the compiler.
199199
- `unix`: Defined when running on an unix system, or when running in MinGW.
200200

201+
## Wildcard patterns in mymake
202+
203+
Wildcard patterns (containing * and ?) work as expected in mymake, with one exception: the character
204+
`/` matches both `/` and `\`, to ease compatibility between systems. Hence, always write your
205+
patterns as if `/` is the path delimiter.
201206

202207
## Variables used by mymake
203208

src/wildcard.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ bool Wildcard::matches(nat strAt, const String &str, nat patternAt) const {
1919
case '?':
2020
strAt++;
2121
break;
22+
case '/':
23+
// / matches both / and \ for simplicity
24+
if (str[strAt] != '/' && str[strAt] != '\\')
25+
return false;
26+
strAt++;
27+
break;
2228
default:
2329
if (pattern[patternAt] != str[strAt])
2430
return false;

0 commit comments

Comments
 (0)