From d3d1bbb883224bfa8737f7b86d9fb712abec0152 Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Mon, 7 Apr 2008 16:49:38 +0000 Subject: [PATCH] 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 --- net/src/TFileStager.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/net/src/TFileStager.cxx b/net/src/TFileStager.cxx index 6c899ed7cc0..2e66be05e5d 100644 --- a/net/src/TFileStager.cxx +++ b/net/src/TFileStager.cxx @@ -27,6 +27,7 @@ #include "TError.h" #include "TFileInfo.h" #include "TSeqCollection.h" +#include "TFile.h" #include "TFileStager.h" #include "TObjString.h" #include "TPluginManager.h" @@ -118,17 +119,25 @@ TFileStager *TFileStager::Open(const char *stager) //______________________________________________________________________________ Bool_t TFileStager::IsStaged(const char *f) { - // Just check if the local file exists locally - - return gSystem->AccessPathName(f) ? kFALSE : kTRUE; + // Just check if the file exists locally + + // 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) { - // Just check if the local file exists locally + // Just check if the file exists locally - if (gSystem->AccessPathName(u)) + if (!IsStaged(u)) return -1; f = u; return 0; -- GitLab