From cf6e5cfaf812ce233d63f6228bcd483a8cb7129a Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 14 Oct 2021 22:52:44 +0200 Subject: [PATCH] Don't ignore '\' characters when '/' isn't present in file names --- src/main.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ca5bd44..559791d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -50,14 +50,14 @@ int main(int argc, char* argv[]) { } catch (const Yerbacon::Exception& error) { unsigned long lastSlash = 0; unsigned long position1 = fileName.find_last_of('/'); - if (cmp_not_equal(position1, string_view::npos)) { - if constexpr(filesystem::path::preferred_separator == '/') { + if constexpr(filesystem::path::preferred_separator == '/') { + if (cmp_not_equal(position1, string_view::npos)) { lastSlash = position1; - } else { - unsigned long position2 = fileName.find_last_of(filesystem::path::preferred_separator); - if (cmp_not_equal(position2, string_view::npos)) { - lastSlash = max(position1, position2); - } + } + } else { + unsigned long position2 = fileName.find_last_of(filesystem::path::preferred_separator); + if (cmp_not_equal(position2, string_view::npos)) { + lastSlash = max(position1, position2); } } resultingPair.first = fileName.substr(lastSlash + 1);