Skip to content
Snippets Groups Projects
Commit d3d1bbb8 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

From Gerri:

Implement TFileStager::IsStaged using TFile::Open() instead of AccessPathName().


git-svn-id: http://root.cern.ch/svn/root/trunk@23028 27541ba8-7e3a-0410-8455-c3a389f83636
parent 96fac75d
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "TError.h" #include "TError.h"
#include "TFileInfo.h" #include "TFileInfo.h"
#include "TSeqCollection.h" #include "TSeqCollection.h"
#include "TFile.h"
#include "TFileStager.h" #include "TFileStager.h"
#include "TObjString.h" #include "TObjString.h"
#include "TPluginManager.h" #include "TPluginManager.h"
...@@ -118,17 +119,25 @@ TFileStager *TFileStager::Open(const char *stager) ...@@ -118,17 +119,25 @@ TFileStager *TFileStager::Open(const char *stager)
//______________________________________________________________________________ //______________________________________________________________________________
Bool_t TFileStager::IsStaged(const char *f) Bool_t TFileStager::IsStaged(const char *f)
{ {
// Just check if the local file exists locally // Just check if the file exists locally
return gSystem->AccessPathName(f) ? kFALSE : kTRUE; // The safest is to open in raw mode
TUrl u(f);
u.SetOptions("filetype=raw");
TFile *ff = TFile::Open(u.GetUrl());
Bool_t rc = (ff && !ff->IsZombie()) ? kTRUE : kFALSE;
ff->Close();
delete ff;
// Done
return rc;
} }
//______________________________________________________________________________ //______________________________________________________________________________
Int_t TFileStager::Locate(const char *u, TString &f) Int_t TFileStager::Locate(const char *u, TString &f)
{ {
// Just check if the local file exists locally // Just check if the file exists locally
if (gSystem->AccessPathName(u)) if (!IsStaged(u))
return -1; return -1;
f = u; f = u;
return 0; return 0;
......
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