MCPcopy Create free account
hub / github.com/3Shain/dxmt / matchFileExtension

Function matchFileExtension

src/util/util_env.cpp:43–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43size_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
59std::string getExeName() {
60 std::string fullPath = getExePath();

Callers 1

getExeBaseNameFunction · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected