Index: branches/qt_gui/src/lib/util/directory.h
===================================================================
--- branches/qt_gui/src/lib/util/directory.h	(revision 7609)
+++ branches/qt_gui/src/lib/util/directory.h	(revision 7609)
@@ -0,0 +1,248 @@
+/**
+ * Copyright (C) 2002 Bart Vanhauwaert
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * for any purpose is hereby granted without fee. This license
+ * includes (but is not limited to) standalone compilation or as part
+ * of a larger project.
+ *
+ * This software is provided "as is" without express or implied warranty.
+ *
+ * For a full statement on warranty and terms and conditions for
+ * copying, distribution and modification, please see the comment block
+ * at the end of this file.
+ *
+ * Version 1
+ *
+ */
+
+#ifndef OSLINK_OSDIR_HEADER_H_
+#define OSLINK_OSDIR_HEADER_H_
+
+#if defined(unix) || defined(__unix) || defined(__unix__)
+#define OSLINK_OSDIR_POSIX
+#elif defined(_WIN32)
+#define OSLINK_OSDIR_WINDOWS
+#else
+#define OSLINK_OSDIR_NOTSUPPORTED
+#endif
+
+#include <string>
+
+#if defined(OSLINK_OSDIR_NOTSUPPORTED)
+
+namespace OS
+{
+  class Directory
+  {
+    public:
+      Directory(const std::string&) { }
+      bool open(const std::string&) {};
+      void close() {};
+
+      operator void*() const { return (void*)0; }
+      std::string next() { return ""; }
+  };
+}
+
+#elif defined(OSLINK_OSDIR_POSIX)
+
+#include <sys/types.h>
+#include <dirent.h>
+
+namespace OS
+{
+  class Directory
+  {
+    public:
+      Directory(const std::string& directoryName = "")
+          : willfail(false)
+      {
+        this->handle = NULL;
+        this->willfail = true;
+        this->open(directoryName);
+      }
+
+      ~Directory()
+      {
+        this->close();
+      }
+
+      bool open(const std::string& directoryName)
+      {
+        if (this->handle != NULL)
+          this->close();
+        this->handle = opendir(directoryName.c_str());
+        if (!handle)
+          willfail = true;
+        else
+        {
+          willfail = false;
+          dirent* entry = readdir(handle);
+          if (entry)
+            current = entry->d_name;
+          else
+            willfail = true;
+        }
+      }
+
+      void close()
+      {
+        if (this->handle != NULL)
+          closedir(handle);
+        this->handle = NULL;
+        this->willfail = true;
+        this->current = "";
+      }
+
+      operator void*() const
+      {
+        return willfail ? (void*)0:(void*)(-1);
+      }
+
+      std::string next()
+      {
+        std::string prev(current);
+        dirent* entry = readdir(handle);
+        if (entry)
+          current = entry->d_name;
+        else
+          willfail = true;
+        return prev;
+      }
+
+    private:
+      DIR* handle;
+      bool willfail;
+      std::string current;
+  };
+}
+
+#elif defined(OSLINK_OSDIR_WINDOWS)
+
+#ifdef DATADIR
+#undef DATADIR
+#endif
+
+#include <windows.h>
+#include <winbase.h>
+
+namespace OS
+{
+  class Directory
+  {
+    public:
+      Directory(const std::string& directoryName = "")
+          : handle(INVALID_HANDLE_VALUE), willfail(true)
+      {
+        this->open(directoryName);
+      }
+
+      ~Directory()
+      {
+	this->close();
+      }
+
+      bool open(const std::string& directoryName)
+      {
+        if (handle != INVALID_HANDLE_VALUE)
+          this->close();
+
+        // First check the attributes trying to access a non-Directory with
+        // FindFirstFile takes ages
+        DWORD attrs = GetFileAttributes(directoryName.c_str());
+        if ( (attrs == 0xFFFFFFFF) || ((attrs && FILE_ATTRIBUTE_DIRECTORY) == 0) )
+        {
+          willfail = true;
+          return false;
+        }
+        std::string Full(directoryName);
+        // Circumvent a problem in FindFirstFile with c:\\* as parameter
+        if ( (Full.length() > 0) && (Full[Full.length()-1] != '\\') )
+          Full += "\\";
+        WIN32_FIND_DATA entry;
+        handle = FindFirstFile( (Full+"*").c_str(), &entry);
+        if (handle == INVALID_HANDLE_VALUE)
+	  {
+	    willfail = true;
+	    return false;
+	  }
+        else
+	  {
+	    willfail = false;
+	    current = entry.cFileName;
+	    return true;
+	  }
+      }
+
+      void close()
+      {
+        if (handle != INVALID_HANDLE_VALUE)
+          FindClose(handle);
+        this->willfail = true;
+      }
+
+      operator void*() const
+      {
+        return willfail ? (void*)0:(void*)(-1);
+      }
+
+      std::string next()
+      {
+        std::string prev = current;
+        WIN32_FIND_DATA entry;
+        int ok = FindNextFile(handle, &entry);
+        if (!ok)
+          willfail = true;
+        else
+          current = entry.cFileName;
+        return current;
+      }
+
+
+    private:
+      HANDLE    handle;
+      bool      willfail;
+      std::string current;
+  };
+}
+
+
+#endif
+
+#endif
+
+/**
+ *
+ * The "library", above, refers to the collection of software functions
+ * and/or data contained in this file, prepared so as to be conveniently
+ * compiled and linked with application programs (which use some of those
+ * functions and data) to form executables.
+ *
+ *                             NO WARRANTY
+ *
+ * 1. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+ * WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+ * EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+ * OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+ * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+ * LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+ * THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+ *
+ * 2. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+ * WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+ * AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+ * FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+ * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+ * LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+ * RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+ * FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+ * SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGES.
+ *
+ * END OF TERMS AND CONDITIONS
+ *
+ */
+
Index: branches/qt_gui/src/lib/util/file.cc
===================================================================
--- branches/qt_gui/src/lib/util/file.cc	(revision 7609)
+++ branches/qt_gui/src/lib/util/file.cc	(revision 7609)
@@ -0,0 +1,16 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
Index: branches/qt_gui/src/lib/util/file.h
===================================================================
--- branches/qt_gui/src/lib/util/file.h	(revision 7609)
+++ branches/qt_gui/src/lib/util/file.h	(revision 7609)
@@ -0,0 +1,56 @@
+/*!
+ * @file file.h
+ * @brief Definition of File Handler class
+ */
+
+#ifndef __FILE_H_
+#define __FILE_H_
+
+
+#include <string>
+
+class File
+{
+  public:
+  typedef enum
+  {
+    ReadOnly,
+    WriteOnly,
+    ReadWrite,
+    Append,
+  } OpenMode;
+
+public:
+  File();
+  File(const std::string& fileName);
+  File(const File& file);
+  ~File();
+
+  virtual bool open(OpenMode mode);
+  virtual bool close();
+  int handle();
+
+  bool exists();
+  bool isLink(); // only on UNIX
+  bool isFile();
+  bool isReadeable();
+  bool isWriteable();
+  bool isExecutable();
+
+
+  bool copy(const File& destination);
+  bool rename(const File& destination);
+  bool touch();
+  bool remove();
+
+  static void relToAbs(std::string& fileName);
+
+  private:
+    void homeDirCheck(std::string& fileName);
+
+  private:
+    int          _handle;          //!< The FileHandle (if set).
+    std::string  name;             //!< The Name of the File.
+};
+
+#endif /* __FILE_H_ */
Index: branches/qt_gui/src/lib/util/osdir.h
===================================================================
--- branches/qt_gui/src/lib/util/osdir.h	(revision 7607)
+++ 	(revision )
@@ -1,248 +1,0 @@
-/**
- * Copyright (C) 2002 Bart Vanhauwaert
- *
- * Permission to use, copy, modify, distribute and sell this software
- * for any purpose is hereby granted without fee. This license
- * includes (but is not limited to) standalone compilation or as part
- * of a larger project.
- *
- * This software is provided "as is" without express or implied warranty.
- *
- * For a full statement on warranty and terms and conditions for
- * copying, distribution and modification, please see the comment block
- * at the end of this file.
- *
- * Version 1
- *
- */
-
-#ifndef OSLINK_OSDIR_HEADER_H_
-#define OSLINK_OSDIR_HEADER_H_
-
-#if defined(unix) || defined(__unix) || defined(__unix__)
-#define OSLINK_OSDIR_POSIX
-#elif defined(_WIN32)
-#define OSLINK_OSDIR_WINDOWS
-#else
-#define OSLINK_OSDIR_NOTSUPPORTED
-#endif
-
-#include <string>
-
-#if defined(OSLINK_OSDIR_NOTSUPPORTED)
-
-namespace OS
-{
-  class Directory
-  {
-    public:
-      Directory(const std::string&) { }
-      bool open(const std::string&) {};
-      void close() {};
-
-      operator void*() const { return (void*)0; }
-      std::string next() { return ""; }
-  };
-}
-
-#elif defined(OSLINK_OSDIR_POSIX)
-
-#include <sys/types.h>
-#include <dirent.h>
-
-namespace OS
-{
-  class Directory
-  {
-    public:
-      Directory(const std::string& directoryName = "")
-          : willfail(false)
-      {
-        this->handle = NULL;
-        this->willfail = true;
-        this->open(directoryName);
-      }
-
-      ~Directory()
-      {
-        this->close();
-      }
-
-      bool open(const std::string& directoryName)
-      {
-        if (this->handle != NULL)
-          this->close();
-        this->handle = opendir(directoryName.c_str());
-        if (!handle)
-          willfail = true;
-        else
-        {
-          willfail = false;
-          dirent* entry = readdir(handle);
-          if (entry)
-            current = entry->d_name;
-          else
-            willfail = true;
-        }
-      }
-
-      void close()
-      {
-        if (this->handle != NULL)
-          closedir(handle);
-        this->handle = NULL;
-        this->willfail = true;
-        this->current = "";
-      }
-
-      operator void*() const
-      {
-        return willfail ? (void*)0:(void*)(-1);
-      }
-
-      std::string next()
-      {
-        std::string prev(current);
-        dirent* entry = readdir(handle);
-        if (entry)
-          current = entry->d_name;
-        else
-          willfail = true;
-        return prev;
-      }
-
-    private:
-      DIR* handle;
-      bool willfail;
-      std::string current;
-  };
-}
-
-#elif defined(OSLINK_OSDIR_WINDOWS)
-
-#ifdef DATADIR
-#undef DATADIR
-#endif
-
-#include <windows.h>
-#include <winbase.h>
-
-namespace OS
-{
-  class Directory
-  {
-    public:
-      Directory(const std::string& directoryName = "")
-          : handle(INVALID_HANDLE_VALUE), willfail(true)
-      {
-        this->open(directoryName);
-      }
-
-      ~Directory()
-      {
-	this->close();
-      }
-
-      bool open(const std::string& directoryName)
-      {
-        if (handle != INVALID_HANDLE_VALUE)
-          this->close();
-
-        // First check the attributes trying to access a non-Directory with
-        // FindFirstFile takes ages
-        DWORD attrs = GetFileAttributes(directoryName.c_str());
-        if ( (attrs == 0xFFFFFFFF) || ((attrs && FILE_ATTRIBUTE_DIRECTORY) == 0) )
-        {
-          willfail = true;
-          return false;
-        }
-        std::string Full(directoryName);
-        // Circumvent a problem in FindFirstFile with c:\\* as parameter
-        if ( (Full.length() > 0) && (Full[Full.length()-1] != '\\') )
-          Full += "\\";
-        WIN32_FIND_DATA entry;
-        handle = FindFirstFile( (Full+"*").c_str(), &entry);
-        if (handle == INVALID_HANDLE_VALUE)
-	  {
-	    willfail = true;
-	    return false;
-	  }
-        else
-	  {
-	    willfail = false;
-	    current = entry.cFileName;
-	    return true;
-	  }
-      }
-
-      void close()
-      {
-        if (handle != INVALID_HANDLE_VALUE)
-          FindClose(handle);
-        this->willfail = true;
-      }
-
-      operator void*() const
-      {
-        return willfail ? (void*)0:(void*)(-1);
-      }
-
-      std::string next()
-      {
-        std::string prev = current;
-        WIN32_FIND_DATA entry;
-        int ok = FindNextFile(handle, &entry);
-        if (!ok)
-          willfail = true;
-        else
-          current = entry.cFileName;
-        return current;
-      }
-
-
-    private:
-      HANDLE    handle;
-      bool      willfail;
-      std::string current;
-  };
-}
-
-
-#endif
-
-#endif
-
-/**
- *
- * The "library", above, refers to the collection of software functions
- * and/or data contained in this file, prepared so as to be conveniently
- * compiled and linked with application programs (which use some of those
- * functions and data) to form executables.
- *
- *                             NO WARRANTY
- *
- * 1. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
- * WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
- * EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
- * OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
- * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
- * LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
- * THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
- *
- * 2. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
- * WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
- * AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
- * FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
- * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
- * LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
- * RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
- * FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
- * SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGES.
- *
- * END OF TERMS AND CONDITIONS
- *
- */
-
