From e629a981480b402b98e0b52224d485c73de03783 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Tue, 17 Mar 2015 12:32:25 +0000
Subject: [PATCH] Fix Environment variables for TinyXML

Add getEnviron check to _clean_fname function
---
 DDCore/src/XML/DocumentHandler.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/DDCore/src/XML/DocumentHandler.cpp b/DDCore/src/XML/DocumentHandler.cpp
index d5f7feb4f..32702402f 100644
--- a/DDCore/src/XML/DocumentHandler.cpp
+++ b/DDCore/src/XML/DocumentHandler.cpp
@@ -268,8 +268,10 @@ namespace DD4hep {
 
 namespace {
   static string _clean_fname(const string& s) {
-    if ( strncmp(s.c_str(),"file:",5)==0 ) return s.substr(5);
-    return s;
+    std::string const& temp = getEnviron(s);
+    std::string temp2 = temp.empty() ? s : temp;
+    if ( strncmp(temp2.c_str(),"file:",5)==0 ) return temp2.substr(5);
+    return temp2;
   }
 }
 
-- 
GitLab