Index: trunk/src/util/resource_manager.cc
===================================================================
--- trunk/src/util/resource_manager.cc	(revision 5334)
+++ trunk/src/util/resource_manager.cc	(revision 5335)
@@ -60,6 +60,6 @@
   this->dataDir = NULL;
   this->setDataDir("./");
-  this->imageDirs = new tList<char>();
-  this->resourceList = new tList<Resource>();
+  this->imageDirs = new tList<char>;
+  this->resourceList = new tList<Resource>;
 }
 
@@ -105,6 +105,16 @@
     {
       delete[] this->dataDir;
-      this->dataDir = new char[strlen(realDir)+1];
-      strcpy(this->dataDir, realDir);
+      if (dataDir[strlen(dataDir)-1] == '/' || dataDir[strlen(dataDir)-1] == '\\')
+      {
+        this->dataDir = new char[strlen(realDir)+1];
+        strcpy(this->dataDir, realDir);
+      }
+      else
+      {
+        this->dataDir = new char[strlen(realDir)+2];
+        strcpy(this->dataDir, realDir);
+        this->dataDir[strlen(realDir)] = '/';
+        this->dataDir[strlen(realDir)+1] = '\0';
+      }
       delete[] realDir;
       return true;
@@ -147,6 +157,22 @@
 bool ResourceManager::addImageDir(const char* imageDir)
 {
+  if (imageDir == NULL)
+    return false;
+
+  char* newDir;
+  if (imageDir[strlen(imageDir)-1] == '/' || imageDir[strlen(imageDir)-1] == '\\')
+  {
+    newDir = new char[strlen(imageDir)+1];
+    strcpy(newDir, imageDir);
+  }
+  else
+  {
+    newDir = new char[strlen(imageDir)+2];
+    strcpy(newDir, imageDir);
+    newDir[strlen(imageDir)] = '/';
+    newDir[strlen(imageDir)+1] = '\0';
+  }
   // check if the param is a Directory
-  if (isDir(imageDir))
+  if (isDir(newDir))
     {
       // check if the Directory has been added before
@@ -155,7 +181,8 @@
       while(tmpDir)
         {
-          if (!strcmp(tmpDir, imageDir))
+          if (!strcmp(tmpDir, newDir))
             {
-              PRINTF(4)("Path %s already loaded\n", imageDir);
+              PRINTF(3)("Path %s already loaded\n", newDir);
+              delete[] newDir;
               delete tmpImageDirs;
               return true;
@@ -166,12 +193,11 @@
 
       // adding the directory to the List
-      tmpDir  = new char[strlen(imageDir)+1];
-      strcpy(tmpDir, imageDir);
-      this->imageDirs->add(tmpDir);
+      this->imageDirs->add(newDir);
       return true;
     }
   else
     {
-      PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", dataDir);
+      PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", newDir);
+      delete[] newDir;
       return false;
     }
@@ -660,5 +686,5 @@
       directoryName[strlen(directoryName)-1] == '\\')
     {
-      tmpDirName = new char[strlen(directoryName)+1];
+      tmpDirName = new char[strlen(directoryName)];
       strncpy(tmpDirName, directoryName, strlen(directoryName)-1);
       tmpDirName[strlen(directoryName)-1] = '\0';
@@ -800,5 +826,5 @@
 char* ResourceManager::getFullName(const char* fileName)
 {
-  if (fileName == NULL)
+  if (fileName == NULL || ResourceManager::getInstance()->getDataDir() == NULL)
     return NULL;
 
@@ -813,4 +839,28 @@
       return NULL;
     }
+}
+
+
+/**
+ * checks wether a file is in the DataDir.
+ * @param fileName the File to check if it is in the Data-Dir structure.
+ * @returns true if the file exists, false otherwise
+ */
+bool ResourceManager::isInDataDir(const char* fileName)
+{
+  if (fileName == NULL || ResourceManager::getInstance()->getDataDir() == NULL)
+    return false;
+
+  bool retVal = false;
+  char* checkFile = new char[strlen(ResourceManager::getInstance()->getDataDir())
+      + strlen(fileName) + 1];
+  sprintf(checkFile, "%s%s", ResourceManager::getInstance()->getDataDir(), fileName);
+
+  if (ResourceManager::isFile(checkFile) || ResourceManager::isDir(checkFile))
+    retVal = true;
+  else
+    retVal = false;
+  delete[] checkFile;
+  return retVal;
 }
 
Index: trunk/src/util/resource_manager.h
===================================================================
--- trunk/src/util/resource_manager.h	(revision 5334)
+++ trunk/src/util/resource_manager.h	(revision 5335)
@@ -108,5 +108,5 @@
 
   bool checkDataDir(const char* fileInside);
-  bool addImageDir(const char* imageDir);
+ bool addImageDir(const char* imageDir);
   BaseObject* load(const char* fileName, ResourcePriority prio = RP_NO,
                void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
@@ -127,4 +127,5 @@
   static char* homeDirCheck(const char* fileName);
   static char* getFullName(const char* fileName);
+  static bool isInDataDir(const char* fileName);
 
   static const char* ResourceTypeToChar(ResourceType type);
Index: trunk/src/util/track/track_manager.cc
===================================================================
--- trunk/src/util/track/track_manager.cc	(revision 5334)
+++ trunk/src/util/track/track_manager.cc	(revision 5335)
@@ -900,6 +900,6 @@
  * @param count The count of Paths to join.
  * @param trackIDs an Array with the trackID's to join
-
-   \see void TrackManager::join(unsigned int count, ...)
+ *
+ * @see void TrackManager::join(unsigned int count, ...)
 */
 void TrackManager::joinV(unsigned int count, int* trackIDs)
