Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8538)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8539)
@@ -18,4 +18,21 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2007/05/25 Thomas Bretz
+
+   * callisto.cc, star.cc:
+     - removed obsolete check whether config file exists
+
+   * sponde.cc:
+     - aded check for validity of config file (returns 0xfe if not)
+
+   * mbase/MEnv.[h,cc]:
+     - removed obsolete fName workaround
+     - made sure that also ~ paths are correctly expanded and used
+
+   * mjobs/MJob.cc:
+     - one more sanity check if MEnv is not valid
+
+
 
  2007/05/22 Daniel Hoehne
Index: /trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.cc	(revision 8538)
+++ /trunk/MagicSoft/Mars/callisto.cc	(revision 8539)
@@ -261,10 +261,4 @@
         return 3;
 
-    if (gSystem->AccessPathName(kConfig, kFileExists))
-    {
-        gLog << err << "Sorry, config file '" << kConfig << "' doesn't exist." << endl;
-        return 4;
-    }
-
     if (kDebugMem)
         TObject::SetObjectStat(kTRUE);
Index: /trunk/MagicSoft/Mars/mbase/MEnv.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEnv.cc	(revision 8538)
+++ /trunk/MagicSoft/Mars/mbase/MEnv.cc	(revision 8539)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  2/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2005
+!   Copyright: MAGIC Software Development, 2000-2007
 !
 !
@@ -51,12 +51,12 @@
 //---------------------------------------------------------------------------
 //
-// (Default) constructor. If the given file cannot be accessed the data
-// member fName is set to "" which can then be checked by IsValid()
-//
-MEnv::MEnv(const char *name) : TEnv(name), fName(name)
+// (Default) constructor. If the given file cannot be accessed SetRcName("")
+// is called which can then be checked by IsValid()
+//
+MEnv::MEnv(const char *name) : TEnv(name)
 {
     fChecked.SetOwner();
 
-    if (fName.IsNull())
+    if (!IsValid())
         return;
 
@@ -65,5 +65,22 @@
 
     if (gSystem->AccessPathName(fname, kFileExists))
-        fName = "";
+        fname = "";
+
+    SetRcName(fname);
+
+    if (GetEntries()<=0 && !fname.IsNull() && fname!=name)
+        ReadFile(fname, kEnvLocal);;
+}
+
+//---------------------------------------------------------------------------
+//
+// Return the total number of entries in the table
+//
+Int_t MEnv::GetEntries() const
+{
+    if (!GetTable())
+        return -1;
+
+    return GetTable()->GetEntries();
 }
 
@@ -123,5 +140,5 @@
 {
     MEnv *env = new MEnv("/dev/null");
-    env->fName = fName;
+    env->SetRcName(GetRcName());
     env->AddEnv(*this);
     return env;
@@ -836,5 +853,8 @@
     int i=0;
     gLog << inf << flush;
-    gLog.Separator("Untouched Resources");
+
+    TString sep = "Untouched Resources - ";
+    sep += GetRcName();
+    gLog.Separator(sep);
     TIter Next(GetTable());
     TObject *o=0;
Index: /trunk/MagicSoft/Mars/mbase/MEnv.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 8538)
+++ /trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 8539)
@@ -21,6 +21,4 @@
     TOrdCollection fChecked;
 
-    TString fName; // A workaround!
-
     TString Compile(TString str, const char *post) const;
 
@@ -28,5 +26,5 @@
     MEnv(const char *name="");
 
-    Bool_t      IsValid() const { return !fName.IsNull(); }
+    Bool_t      IsValid() const { return !TString(GetRcName()).IsNull(); }
 
     TObject    *Clone(const char *newname="") const;
@@ -34,9 +32,11 @@
     Bool_t      Touch(const char *name) { return !TString(GetValue(name, "")).IsNull(); }
 
+    Int_t       GetEntries() const;
+
     Int_t       GetValue(const char *name, Int_t dflt);
     Double_t    GetValue(const char *name, Double_t dflt);
     const char *GetValue(const char *name, const char *dflt);
 
-    const char *GetName() const { return fName; }
+    const char *GetName() const { return GetRcName(); }
 
     Int_t       GetColor(const char *name, Int_t dftl);
Index: /trunk/MagicSoft/Mars/mjobs/MJob.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 8538)
+++ /trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 8539)
@@ -83,13 +83,12 @@
     ClearEnv();
 
-    const Bool_t fileexist = !gSystem->AccessPathName(env, kFileExists);
-    if (!fileexist)
-    {
-        *fLog << err << "ERROR - Resource file '" << env << "' not found... no resources applied." << endl;
-        return kFALSE;
-    }
-
     fEnv = new MEnv(env);
     SetBit(kIsOwner);
+
+    if (!fEnv->IsValid())
+    {
+        ClearEnv();
+        return kFALSE;
+    }
 
     fEnvPrefix = prefix;
Index: /trunk/MagicSoft/Mars/star.cc
===================================================================
--- /trunk/MagicSoft/Mars/star.cc	(revision 8538)
+++ /trunk/MagicSoft/Mars/star.cc	(revision 8539)
@@ -160,10 +160,4 @@
         return 2;
 
-    if (gSystem->AccessPathName(kConfig, kFileExists))
-    {
-        gLog << err << "Sorry, config file '" << kConfig << "' doesn't exist." << endl;
-        return 2;
-    }
-
     //
     // Setup sequence and check its validity
