Skip to content

Commit

Permalink
[tree] Fix invalid macro names when absolute filepath is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdymercury authored Oct 6, 2024
1 parent 7796472 commit 54daf70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tree/treeviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

6 changes: 3 additions & 3 deletions tree/treeviewer/src/TTreeViewer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ or :
#include "strlcpy.h"
#include "snprintf.h"

#include <filesystem>

#ifdef WIN32
#include "TWin32SplashThread.h"
#endif
Expand Down Expand Up @@ -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);"<<std::endl<<std::endl;
out <<"void "<<sname.Data()<<"() {"<<std::endl;
out <<"void "<<std::filesystem::path(fname).stem()<<"() {"<<std::endl;
out <<"//=========Macro generated by ROOT version"<<gROOT->GetVersion()<<std::endl;
out <<"//=========for tree "<<quote<<fTree->GetName()<<quote<<" ("<<t.AsString()<<")"<<std::endl;
out <<"//===This macro can be opened from a TreeViewer session after loading"<<std::endl;
Expand Down

0 comments on commit 54daf70

Please sign in to comment.