MCPcopy Create free account
hub / github.com/Rezonality/zep / GetFileExtension

Method GetFileExtension

src/buffer.cpp:544–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542}
543
544std::string ZepBuffer::GetFileExtension() const
545{
546 std::string ext;
547 if (GetFilePath().has_filename() && GetFilePath().filename().has_extension())
548 {
549 ext = string_tolower(GetFilePath().filename().extension().string());
550 }
551 else
552 {
553 auto str = GetName();
554 size_t dot_pos = str.find_last_of(".");
555 if (dot_pos != std::string::npos)
556 {
557 ext = string_tolower(str.substr(dot_pos, str.length() - dot_pos));
558 }
559 }
560 return ext;
561}
562
563// Basic load support; read a file if it's present, but keep
564// the file path in case you want to write later

Callers 1

UpdateLineSpansMethod · 0.80

Calls 6

string_tolowerFunction · 0.85
has_filenameMethod · 0.80
has_extensionMethod · 0.80
filenameMethod · 0.80
extensionMethod · 0.80
stringMethod · 0.45

Tested by

no test coverage detected