From dad3e7f5c4e4fd9c2fe27870ac6592058d5fec56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 14 Feb 2022 21:21:33 +0100 Subject: [PATCH] Replace suffix implementation with std::filesystem --- src/utils.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 3abbed74..c26df17b 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -48,12 +48,7 @@ namespace Util { std::string suffix(const std::string& path) { - std::string b = basename(path); - std::string::size_type idx = b.rfind('.'); - if (idx == std::string::npos || idx == 0 || idx == b.length()-1) { - return ""; - } - return b.substr(idx); + return fs::path(path).extension().string(); } } // namespace Util