| 41 | } |
| 42 | |
| 43 | size_t matchFileExtension(const std::string &name, const char *ext) { |
| 44 | auto pos = name.find_last_of('.'); |
| 45 | |
| 46 | if (pos == std::string::npos) |
| 47 | return pos; |
| 48 | |
| 49 | bool matches = std::accumulate(name.begin() + pos + 1, name.end(), true, |
| 50 | [&ext](bool current, char a) { |
| 51 | if (a >= 'A' && a <= 'Z') |
| 52 | a += 'a' - 'A'; |
| 53 | return current && *ext && a == *(ext++); |
| 54 | }); |
| 55 | |
| 56 | return matches ? pos : std::string::npos; |
| 57 | } |
| 58 | |
| 59 | std::string getExeName() { |
| 60 | std::string fullPath = getExePath(); |
no test coverage detected