.so cleanup: AlienPlugin strips ext before loading
authordberzano <dario.berzano@cern.ch>
Fri, 12 Dec 2014 13:35:13 +0000 (14:35 +0100)
committeragrigora <alina.grigoras@cern.ch>
Mon, 15 Dec 2014 12:52:12 +0000 (13:52 +0100)
Now it is really possible to specify either .so or .dylib and having it
work on any platform.

ANALYSIS/ANALYSISalice/AliAnalysisAlien.cxx

index d55584e..7a1af15 100644 (file)
@@ -4106,9 +4106,14 @@ void AliAnalysisAlien::WriteAnalysisMacro()
          TObjArray *list = fAdditionalRootLibs.Tokenize(" ");
          TIter next(list);
          TObjString *str;
+         TString buf;
          while((str=(TObjString*)next())) {
-            if (str->GetString().Contains(".so") || str->GetString().Contains(".dylib"))
-            out << "   gSystem->Load(\"" << str->GetString().Data() << "\");" << endl;
+            buf = str->GetString();
+            if (buf.Contains(".so") || buf.Contains(".dylib")) {
+               buf.ReplaceAll(".so", "");
+               buf.ReplaceAll(".dylib", "");
+               out << "   gSystem->Load(\"" << buf.Data() << "\");" << endl;
+            }
          }
          if (list) delete list;
       }
@@ -4216,11 +4221,16 @@ void AliAnalysisAlien::WriteAnalysisMacro()
          TObjArray *list = additionalLibs.Tokenize(" ");
          TIter next(list);
          TObjString *str;
+         TString buf;
          while((str=(TObjString*)next())) {
-            if (str->GetString().Contains(".so") || str->GetString().Contains(".dylib"))
-               out << "   gSystem->Load(\"" << str->GetString().Data() << "\");" << endl;
-            if (str->GetString().Contains(".par"))
-               out << "   if (!" << setupPar << "(\"" << str->GetString() << "\")) return;" << endl;
+            buf = str->GetString();
+            if (buf.Contains(".so") || buf.Contains(".dylib")) {
+               buf.ReplaceAll(".so", "");
+               buf.ReplaceAll(".dylib", "");
+               out << "   gSystem->Load(\"" << buf.Data() << "\");" << endl;
+            }
+            if (buf.Contains(".par"))
+               out << "   if (!" << setupPar << "(\"" << buf.Data() << "\")) return;" << endl;
          }
          delete list;
       }
@@ -4500,9 +4510,14 @@ void AliAnalysisAlien::WriteMergingMacro()
          TObjArray *list = fAdditionalRootLibs.Tokenize(" ");
          TIter next(list);
          TObjString *str;
+         TString buf;
          while((str=(TObjString*)next())) {
-            if (str->GetString().Contains(".so") || str->GetString().Contains(".dylib"))
-            out << "   gSystem->Load(\"" << str->GetString().Data() << "\");" << endl;
+            buf = str->GetString();
+            if (buf.Contains(".so") || buf.Contains(".dylib")) {
+               buf.ReplaceAll(".so", "");
+               buf.ReplaceAll(".dylib", "");
+               out << "   gSystem->Load(\"" << buf.Data() << "\");" << endl;
+            }
          }
          if (list) delete list;
       }
@@ -4611,9 +4626,14 @@ void AliAnalysisAlien::WriteMergingMacro()
          TObjArray *list = additionalLibs.Tokenize(" ");
          TIter next(list);
          TObjString *str;
+         TString buf;
          while((str=(TObjString*)next())) {
-            if (str->GetString().Contains(".so") || str->GetString().Contains(".dylib"))
-               out << "   gSystem->Load(\"" << str->GetString().Data() << "\");" << endl;
+            buf = str->GetString();
+            if (buf.Contains(".so") || buf.Contains(".dylib")) {
+               buf.ReplaceAll(".so", "");
+               buf.ReplaceAll(".dylib", "");
+               out << "   gSystem->Load(\"" << buf.Data() << "\");" << endl;
+            }
          }
          if (list) delete list;
       }