From d256da385805c11ca44f6ee73cb394a12ee21eb4 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Sun, 8 Sep 2024 01:15:02 +0200 Subject: [PATCH] Fix debugging-info on Windows The file separator bite again --- lib/debug_info.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/debug_info.cpp b/lib/debug_info.cpp index 4984379e..b05f78cc 100644 --- a/lib/debug_info.cpp +++ b/lib/debug_info.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include "debug_info.h" @@ -43,6 +45,7 @@ dbg_pattern::dbg_pattern(QString part) } } } + file = QDir::cleanPath(file); qDebug() << "New debug match" << (inv ? "Not" : "") << file << func << first << last; } @@ -84,16 +87,16 @@ debug_info::debug_info(const QMessageLogContext &ctx) { line = ctx.line; if (ctx.file && ctx.line) { - int pos; - short_file = ctx.file, short_func = ctx.function; - pos = short_file.lastIndexOf("/"); - short_file.remove(0, pos +1); - pos = short_func.indexOf("("); + QFileInfo f(ctx.file); + short_file = f.fileName(); + + short_func = ctx.function; + int pos = short_func.indexOf("("); short_func.remove(pos, short_func.size()); pos = short_func.lastIndexOf(" "); short_func.remove(0, pos +1); } - //std::cerr << "DBG '" << (ctx.function ?: "(NULL)" )<< "' '" << CCHAR(short_func) << "' " << std::endl; + //std::cerr << "DBG '" << (ctx.function ?: "(NULL)" )<< "' '" << CCHAR(short_func) << "' " << short_file << std::endl; } QString debug_info::log_prefix() const