| 542 | } |
| 543 | |
| 544 | std::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 |
no test coverage detected