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 1, 2024
1 parent b9ab609 commit 4985318
Showing 1 changed file with 3 additions and 3 deletions.
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.Data()).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 4985318

Please sign in to comment.