diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-07-27 14:28:49 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-07-27 14:28:49 -0500 |
commit | ff01c3ade4c092214d9488b10cbca995fbc7f159 (patch) | |
tree | e30c08e57338ee269373f65911e26ebe997c26d6 /src | |
parent | Merge pull request #4109 (diff) | |
parent | core_tests: add --filter to select which tests to run (diff) | |
download | monero-ff01c3ade4c092214d9488b10cbca995fbc7f159.tar.xz |
Merge pull request #4110
639ca3b core_tests: add --filter to select which tests to run (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r-- | src/common/util.cpp | 19 | ||||
-rw-r--r-- | src/common/util.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp index 7d9d7b408..f644c573c 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -919,4 +919,23 @@ std::string get_nix_version_display_string() return {}; } } + + std::string glob_to_regex(const std::string &val) + { + std::string newval; + + bool escape = false; + for (char c: val) + { + if (c == '*') + newval += escape ? "*" : ".*"; + else if (c == '?') + newval += escape ? "?" : "."; + else if (c == '\\') + newval += '\\', escape = !escape; + else + newval += c; + } + return newval; + } } diff --git a/src/common/util.h b/src/common/util.h index a57a85fee..6ec901e7f 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -231,4 +231,6 @@ namespace tools bool is_hdd(const char *path); boost::optional<std::pair<uint32_t, uint32_t>> parse_subaddress_lookahead(const std::string& str); + + std::string glob_to_regex(const std::string &val); } |