Skip to content
Snippets Groups Projects
Commit afef8adf authored by Philippe Canal's avatar Philippe Canal
Browse files

Insure that the output file meta data is properly updated by calling...

Insure that the output file meta data is properly updated by calling TFile::Close before copying it.
Add a 'progressbar' flag to TFileMerger::Merge to allow for 'quiet' operation.


git-svn-id: http://root.cern.ch/svn/root/trunk@27117 27541ba8-7e3a-0410-8455-c3a389f83636
parent f5e9734e
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,7 @@ public:
virtual Bool_t AddFile(const char *url);
virtual Bool_t OutputFile(const char *url);
virtual void PrintFiles(Option_t *options);
virtual Bool_t Merge();
virtual Bool_t Merge(Bool_t progressbar = kTRUE);
virtual Bool_t MergeRecursive(TDirectory *target, TList *sourcelist, Int_t isdir);
virtual void SetFastMethod(Bool_t fast=kTRUE) {fFastMethod = fast;}
virtual void SetNotrees(Bool_t notrees=kFALSE) {fNoTrees = notrees;}
......
......@@ -156,11 +156,13 @@ void TFileMerger::PrintFiles(Option_t *options)
}
//______________________________________________________________________________
Bool_t TFileMerger::Merge()
Bool_t TFileMerger::Merge(Bool_t cp_progressbar)
{
// Merge the files. If no output file was specified it will write into
// the file "FileMerger.root" in the working directory. Returns true
// on success, false in case of error.
// "cp_progressbar" is pass to TFile::Cp to control whether there is
// visual feedback on the progress of the copy.
if (!fOutputFile) {
Info("Merge", "will merge the results to the file "
......@@ -175,9 +177,10 @@ Bool_t TFileMerger::Merge()
if (!result) {
Error("Merge", "error during merge of your ROOT files");
} else {
//fOutputFile->Write(); Not needed as already done in MergeRecursive()
//fOutputFile->Write(); Not needed as already done in MergeRecursive() ... well actually it is SaveSelf which is a bit different.
fOutputFile->Close(); // But Close is required so the file is complete.
// copy the result file to the final destination
TFile::Cp(fOutputFilename1, fOutputFilename);
TFile::Cp(fOutputFilename1, fOutputFilename,cp_progressbar);
}
// Remove the temporary result file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment