Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 5298)
+++ trunk/MagicSoft/Mars/Changelog	(revision 5299)
@@ -43,4 +43,7 @@
    * mhist/MHCamera.cc:
      - fixed returning GetBinError for kProfile mode switched on
+
+   * mbase/MDirIter.cc:
+     - fixed a bug in the Sort function: AddDirectory was incorrectly used
 
 
Index: trunk/MagicSoft/Mars/mbase/MDirIter.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MDirIter.cc	(revision 5298)
+++ trunk/MagicSoft/Mars/mbase/MDirIter.cc	(revision 5299)
@@ -377,4 +377,16 @@
     TObject *o=0;
     while ((o=NextN()))
-           AddDirectory(o->GetName());
-}
+    {
+        TString dir  = o->GetName();
+        TString name = o->GetName();
+
+        const Int_t last = dir.Last('/');
+        if (last<0)
+            continue;
+
+        dir.Remove(last);
+        name.Remove(0, last+1);
+
+        AddDirectory(dir, name);
+    }
+}
