From 57141e04a62b38ac8eeeabc464e0491ef327aef4 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 18 Aug 2024 23:35:12 +0200 Subject: [PATCH] Simplify printed file paths in the Linux/*BSD crash handler This shortens the printed paths a bit when they would contain `/./`, which is redundant (e.g. `/opt/godot/./core` becomes `/opt/godot/core`). --- platform/linuxbsd/crash_handler_linuxbsd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp index 446fe5c7a1e..469d6491edd 100644 --- a/platform/linuxbsd/crash_handler_linuxbsd.cpp +++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp @@ -133,7 +133,8 @@ static void handle_crash(int sig) { } } - print_error(vformat("[%d] %s (%s)", (int64_t)i, fname, err == OK ? addr2line_results[i] : "")); + // Simplify printed file paths to remove redundant `/./` sections (e.g. `/opt/godot/./core` -> `/opt/godot/core`). + print_error(vformat("[%d] %s (%s)", (int64_t)i, fname, err == OK ? addr2line_results[i].replace("/./", "/") : "")); } free(strings);