| 570 | } |
| 571 | |
| 572 | std::string ZepBuffer::GetFileExtension() const { |
| 573 | std::string ext; |
| 574 | if (GetFilePath().has_filename() && GetFilePath().filename().has_extension()) { |
| 575 | ext = string_tolower(GetFilePath().filename().extension().string()); |
| 576 | } else { |
| 577 | auto str = GetName(); |
| 578 | size_t dot_pos = str.find_last_of("."); |
| 579 | if (dot_pos != std::string::npos) { |
| 580 | ext = string_tolower(str.substr(dot_pos, str.length() - dot_pos)); |
| 581 | } |
| 582 | } |
| 583 | return ext; |
| 584 | } |
| 585 | |
| 586 | // Basic load support; read a file if it's present, but keep |
| 587 | // the file path in case you want to write later |
no test coverage detected