MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / GetExtension

Method GetExtension

Sources/Shared/IO/FileSystem.cpp:1090–1116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1088 }
1089
1090 String FileSystem::GetExtension(StringView path)
1091 {
1092 StringView fileName = GetFileName(path);
1093 if (fileName.empty()) return {};
1094
1095 const StringView foundDot = fileName.findLastOr('.', fileName.end());
1096 if (foundDot.begin() == fileName.end()) return {};
1097
1098 bool initialDots = true;
1099 for (char c : fileName.prefix(foundDot.begin())) {
1100 if (c != '.') {
1101 initialDots = false;
1102 break;
1103 }
1104 }
1105 if (initialDots) return {};
1106 String result = fileName.suffix(foundDot.end());
1107
1108 // Convert to lower-case
1109 for (char& c : result) {
1110 if (c >= 'A' && c <= 'Z') {
1111 c |= 0x20;
1112 }
1113 }
1114
1115 return result;
1116 }
1117
1118#if defined(DEATH_TARGET_WINDOWS)
1119 String FileSystem::FromNativeSeparators(String path)

Callers

nothing calls this directly

Calls 6

emptyMethod · 0.45
findLastOrMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
prefixMethod · 0.45
suffixMethod · 0.45

Tested by

no test coverage detected