]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Allow opening of the file from two places in case at least one of them is read-only...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Sep 2009 16:07:57 +0000 (16:07 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Sep 2009 16:07:57 +0000 (16:07 +0000)
STEER/AliDataLoader.cxx

index ccddb056abde67a91ec02a4ce8050fec4a5f380a..1abb6f33694cae966c77913cbb54a1fd8b3076ec 100644 (file)
@@ -206,9 +206,24 @@ Int_t AliDataLoader::OpenFile(Option_t* opt)
     {
       if(fFile->IsOpen() == kTRUE)
        {
-         AliWarning(Form("File %s already opened by sombody else. First close it.",
-                         fFile->GetName()));
-         return 0;
+         TString option1 = fFile->GetOption();
+         if (option1.CompareTo("read",TString::kIgnoreCase) == 0)
+           {
+             AliInfo(Form("File %s already opened in read mode.",fFile->GetName()));
+           }
+         else
+           {
+             TString option2 = opt;
+             if (option2.CompareTo("read",TString::kIgnoreCase) == 0)
+               {
+                 AliInfo(Form("Open already opened file %s in read mode.",fFile->GetName()));
+               }
+             else {
+               AliWarning(Form("File %s already opened by sombody else. First close it.",
+                               fFile->GetName()));
+               return 0;
+             }
+           }
        }
     }
   
@@ -457,7 +472,7 @@ void AliDataLoader::SetFileNameSuffix(const TString& suffix)
   AliDebug(1, Form("suffix=%s",suffix.Data()));
   AliDebug(1, Form("   Digits File Name before: %s",fFileName.Data()));
   
-  static TString dotroot(".root");
+  static const TString dotroot(".root");
   const TString& suffixdotroot = suffix + dotroot;
   fFileName = fFileName.ReplaceAll(dotroot,suffixdotroot);