From 54daf70308495bc4ec0151d38ca80f941b13875a Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Sun, 6 Oct 2024 20:16:27 +0200 Subject: [PATCH] [tree] Fix invalid macro names when absolute filepath is passed Fixes https://github.com/root-project/root/issues/16562 --- tree/treeviewer/CMakeLists.txt | 4 ++++ tree/treeviewer/src/TTreeViewer.cxx | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tree/treeviewer/CMakeLists.txt b/tree/treeviewer/CMakeLists.txt index 46cd87d9f1aaf..af9a46df3c936 100644 --- a/tree/treeviewer/CMakeLists.txt +++ b/tree/treeviewer/CMakeLists.txt @@ -41,3 +41,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(TreeViewer Gui TreePlayer ) +if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) + target_link_libraries(TreeViewer PUBLIC stdc++fs) # https://github.com/avast/retdec/issues/842 +endif() + diff --git a/tree/treeviewer/src/TTreeViewer.cxx b/tree/treeviewer/src/TTreeViewer.cxx index eb9ad0616048e..48b6aeafdbce2 100644 --- a/tree/treeviewer/src/TTreeViewer.cxx +++ b/tree/treeviewer/src/TTreeViewer.cxx @@ -226,6 +226,8 @@ or : #include "strlcpy.h" #include "snprintf.h" +#include + #ifdef WIN32 #include "TWin32SplashThread.h" #endif @@ -2741,10 +2743,8 @@ void TTreeViewer::SaveSource(const char* filename, Option_t *) } // Write macro header and date/time stamp TDatime t; - TString sname(fname); - sname = sname.ReplaceAll(".C", ""); out <<"void open_session(void *p = 0);"<GetVersion()<GetName()<