From ccddd644ae23c5b02dfbbab4e36ec8d2cb6da4b8 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Mon, 15 Jan 2024 22:28:48 +0100 Subject: [PATCH] fix(logger): fix context shortening on Windows --- src/dwarfs/logger.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dwarfs/logger.cpp b/src/dwarfs/logger.cpp index 4552f2c7..e245ec0b 100644 --- a/src/dwarfs/logger.cpp +++ b/src/dwarfs/logger.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -249,7 +250,7 @@ void stream_logger::set_threshold(level_type threshold) { } std::string get_logger_context(char const* path, int line) { - auto base = ::strrchr(path, '/'); + auto base = ::strrchr(path, std::filesystem::path::preferred_separator); return fmt::format("[{0}:{1}] ", base ? base + 1 : path, line); }