main
Last change
on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago |
Pred finalna verzija
|
-
Property mode
set to
100644
|
File size:
539 bytes
|
Rev | Line | |
---|
[0c6b92a] | 1 | #include "Glob.hh"
|
---|
| 2 |
|
---|
| 3 | #ifdef __wasm32__
|
---|
| 4 | extern "C" bool wasm_regex_match(const char *s, const char *regex);
|
---|
| 5 | #endif
|
---|
| 6 |
|
---|
| 7 | Glob::Glob(std::string raw) {
|
---|
| 8 | mRaw = raw;
|
---|
| 9 | mHash = std::hash<std::string>()(raw);
|
---|
| 10 | #ifndef __wasm32__
|
---|
| 11 | mRegex = std::regex(raw);
|
---|
| 12 | #endif
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | bool Glob::isIgnored(std::string relative_path) const {
|
---|
| 16 | // Use native JS regex engine for wasm to reduce binary size.
|
---|
| 17 | #ifdef __wasm32__
|
---|
| 18 | return wasm_regex_match(relative_path.c_str(), mRaw.c_str());
|
---|
| 19 | #else
|
---|
| 20 | return std::regex_match(relative_path, mRegex);
|
---|
| 21 | #endif
|
---|
| 22 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.