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

Method GetFileNameWithoutExtension

Sources/Shared/IO/FileSystem.cpp:1071–1088  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1069 }
1070
1071 StringView FileSystem::GetFileNameWithoutExtension(StringView path)
1072 {
1073 StringView fileName = GetFileName(path);
1074 if (fileName.empty()) return {};
1075
1076 const StringView foundDot = fileName.findLastOr('.', fileName.end());
1077 if (foundDot.begin() == fileName.end()) return fileName;
1078
1079 bool initialDots = true;
1080 for (char c : fileName.prefix(foundDot.begin())) {
1081 if (c != '.') {
1082 initialDots = false;
1083 break;
1084 }
1085 }
1086 if (initialDots) return fileName;
1087 return fileName.prefix(foundDot.begin());
1088 }
1089
1090 String FileSystem::GetExtension(StringView path)
1091 {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected