From 954855cba4b5c83473056ec43e14c1199d36d909 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Thu, 7 Mar 2024 12:51:30 +0800 Subject: [PATCH] fix location.cc --- src/system/location.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/system/location.cc b/src/system/location.cc index 65ab064..4b1ebc7 100644 --- a/src/system/location.cc +++ b/src/system/location.cc @@ -1,6 +1,19 @@ #include "sled/system/location.h" +#include namespace sled { +size_t +StrippedPathLength() +{ +#ifdef __SLED_LOCATION_STRIPPED_PATH + const char *my_path = __SLED_LOCATION_STRIPPED_PATH; +#else + const char *my_path = "sled/src/system/location.cc"; +#endif + static size_t suffix_len = strlen(my_path); + static size_t full_len = strlen(__FILE__); + return full_len - suffix_len; +} Location Location::Current(const char *file_name, int file_line, const char *function) @@ -9,7 +22,7 @@ Location::Current(const char *file_name, int file_line, const char *function) } Location::Location(const char *file_name, int file_line, const char *function) - : file_name(file_name), + : file_name(file_name + StrippedPathLength()), file_line(file_line), function(function) {}