From af9d32fafd8209ce26a33cf206b44cb80cdc09c2 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 14 Apr 2022 01:54:15 +0000 Subject: refactor: don't redefine file extension --- maple/maple.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maple/maple.cc b/maple/maple.cc index a89ce7b..b500b22 100644 --- a/maple/maple.cc +++ b/maple/maple.cc @@ -37,6 +37,7 @@ auto exit_with[[noreturn]](const char *, bool) -> void; auto main() -> int { sockaddr_in socket_address {}; std::vector gemini_files; + const std::string GEMINI_FILE_EXTENSION = "gmi"; // Try a graceful shutdown when a SIGINT is detected signal(SIGINT, [](int signal_) -> void { @@ -53,14 +54,13 @@ auto main() -> int { std::string file_extension = entry.path().string().substr( entry.path().string().find_last_of('.') + 1 ); - std::string gemini_file_extension = "gmi"; // Only keep track of file if it is a Gemini file if (std::equal( file_extension.begin(), file_extension.end(), - gemini_file_extension.begin(), - gemini_file_extension.end(), + GEMINI_FILE_EXTENSION.begin(), + GEMINI_FILE_EXTENSION.end(), [](char a, char b) -> bool { return std::tolower(a) == std::tolower(b); } )) { gemini_files.push_back(entry.path()); } } -- cgit v1.2.3