Index: code/branches/core5/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/core5/src/libraries/core/CMakeLists.txt	(revision 5832)
+++ code/branches/core5/src/libraries/core/CMakeLists.txt	(revision 5836)
@@ -36,4 +36,5 @@
   ObjectListBase.cc
   OrxonoxClass.cc
+  PathConfig.cc
   Resource.cc
   WindowEventListener.cc
Index: code/branches/core5/src/libraries/core/CommandLine.cc
===================================================================
--- code/branches/core5/src/libraries/core/CommandLine.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/CommandLine.cc	(revision 5836)
@@ -38,5 +38,5 @@
 #include "util/StringUtils.h"
 #include "util/SubString.h"
-#include "Core.h"
+#include "PathConfig.h"
 
 namespace orxonox
@@ -348,5 +348,5 @@
     {
         std::string filename = CommandLine::getValue("optionsFile").getString();
-        boost::filesystem::path filepath(Core::getConfigPath() / filename);
+        boost::filesystem::path filepath(PathConfig::getConfigPath() / filename);
 
         // look for additional arguments in given file or start.ini as default
Index: code/branches/core5/src/libraries/core/ConfigFileManager.cc
===================================================================
--- code/branches/core5/src/libraries/core/ConfigFileManager.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/ConfigFileManager.cc	(revision 5836)
@@ -36,5 +36,5 @@
 #include "ConsoleCommand.h"
 #include "ConfigValueContainer.h"
-#include "Core.h"
+#include "PathConfig.h"
 
 namespace orxonox
@@ -222,9 +222,9 @@
 
         // Get default file if necessary and available
-        boost::filesystem::path filepath(Core::getConfigPath() / this->filename_);
+        boost::filesystem::path filepath(PathConfig::getConfigPath() / this->filename_);
         if (!boost::filesystem::exists(filepath))
         {
             // Try to get default one from the data folder
-            boost::filesystem::path defaultFilepath(Core::getDataPath() / "defaultConfig" / this->filename_);
+            boost::filesystem::path defaultFilepath(PathConfig::getDataPath() / "defaultConfig" / this->filename_);
             if (boost::filesystem::exists(defaultFilepath))
             {
@@ -336,5 +336,5 @@
     {
         std::ofstream file;
-        file.open((Core::getConfigPathString() + filename_).c_str(), std::fstream::out);
+        file.open((PathConfig::getConfigPathString() + filename_).c_str(), std::fstream::out);
         file.setf(std::ios::fixed, std::ios::floatfield);
         file.precision(6);
Index: code/branches/core5/src/libraries/core/Core.cc
===================================================================
--- code/branches/core5/src/libraries/core/Core.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/Core.cc	(revision 5836)
@@ -37,9 +37,5 @@
 
 #include <cassert>
-#include <fstream>
-#include <cstdlib>
-#include <cstdio>
-#include <boost/version.hpp>
-#include <boost/filesystem.hpp>
+#include <vector>
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -50,16 +46,10 @@
 #  undef min
 #  undef max
-#elif defined(ORXONOX_PLATFORM_APPLE)
-#  include <sys/param.h>
-#  include <mach-o/dyld.h>
-#else /* Linux */
-#  include <sys/types.h>
-#  include <unistd.h>
 #endif
 
-#include "SpecialConfig.h"
 #include "util/Debug.h"
 #include "util/Exception.h"
 #include "util/SignalHandler.h"
+#include "PathConfig.h"
 #include "Clock.h"
 #include "CommandExecutor.h"
@@ -80,11 +70,4 @@
 #include "input/InputManager.h"
 
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-#  define BOOST_LEAF_FUNCTION filename
-#else
-#  define BOOST_LEAF_FUNCTION leaf
-#endif
-
 namespace orxonox
 {
@@ -92,6 +75,4 @@
     Core* Core::singletonPtr_s  = 0;
 
-    SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
-    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
     SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -116,12 +97,4 @@
             RegisterRootObject(CoreConfiguration);
             this->setConfigValues();
-
-            // External data directory only exists for dev runs
-            if (Core::isDevelopmentRun())
-            {
-                // Possible data path override by the command line
-                if (!CommandLine::getArgument("externalDataPath")->hasDefaultValue())
-                    tsetExternalDataPath(CommandLine::getValue("externalDataPath"));
-            }
         }
 
@@ -193,15 +166,4 @@
         }
 
-        /**
-        @brief
-            Temporary sets the external data path
-        @param path
-            The new data path
-        */
-        void tsetExternalDataPath(const std::string& path)
-        {
-            externalDataPath_ = boost::filesystem::path(path);
-        }
-
         void initializeRandomNumberGenerator()
         {
@@ -221,13 +183,4 @@
         std::string language_;                          //!< The language
         bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
-
-        //! Path to the parent directory of the ones above if program was installed with relativ pahts
-        boost::filesystem::path rootPath_;
-        boost::filesystem::path executablePath_;        //!< Path to the executable
-        boost::filesystem::path modulePath_;            //!< Path to the modules
-        boost::filesystem::path dataPath_;              //!< Path to the data file folder
-        boost::filesystem::path externalDataPath_;      //!< Path to the external data file folder
-        boost::filesystem::path configPath_;            //!< Path to the config file folder
-        boost::filesystem::path logPath_;               //!< Path to the log file folder
     };
 
@@ -239,9 +192,8 @@
         , consoleCommandDestroyer_(CommandExecutor::destroyExternalCommands)
         , configuration_(new CoreConfiguration()) // Don't yet create config values!
-        , bDevRun_(false)
         , bGraphicsLoaded_(false)
     {
         // Set the hard coded fixed paths
-        this->setFixedPaths();
+        this->pathConfig_.reset(new PathConfig());
 
         // Create a new dynamic library manager
@@ -249,51 +201,15 @@
 
         // Load modules
-        try
-        {
-            // We search for helper files with the following extension
-            std::string moduleextension = specialConfig::moduleExtension;
-            size_t moduleextensionlength = moduleextension.size();
-
-            // Search in the directory of our executable
-            boost::filesystem::path searchpath = this->configuration_->modulePath_;
-
-            // Add that path to the PATH variable in case a module depends on another one
-            std::string pathVariable = getenv("PATH");
-            putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + configuration_->modulePath_.string()).c_str()));
-
-            boost::filesystem::directory_iterator file(searchpath);
-            boost::filesystem::directory_iterator end;
-
-            // Iterate through all files
-            while (file != end)
+        std::vector<std::string>& modulePaths = this->pathConfig_->getModulePaths();
+        for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)
+        {
+            try
             {
-                std::string filename = file->BOOST_LEAF_FUNCTION();
-
-                // Check if the file ends with the exension in question
-                if (filename.size() > moduleextensionlength)
-                {
-                    if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
-                    {
-                        // We've found a helper file - now load the library with the same name
-                        std::string library = filename.substr(0, filename.size() - moduleextensionlength);
-                        boost::filesystem::path librarypath = searchpath / library;
-
-                        try
-                        {
-                            DynLibManager::getInstance().load(librarypath.string());
-                        }
-                        catch (...)
-                        {
-                            COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << Exception::handleMessage() << std::endl;
-                        }
-                    }
-                }
-
-                ++file;
+                this->dynLibManager_->load(*it);
             }
-        }
-        catch (...)
-        {
-            COUT(1) << "An error occurred while loading modules: " << Exception::handleMessage() << std::endl;
+            catch (...)
+            {
+                COUT(1) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << std::endl;
+            }
         }
 
@@ -302,13 +218,13 @@
 
         // Set configurable paths like log, config and media
-        this->setConfigurablePaths();
+        this->pathConfig_->setConfigurablePaths();
 
         // create a signal handler (only active for linux)
         // This call is placed as soon as possible, but after the directories are set
         this->signalHandler_.reset(new SignalHandler());
-        this->signalHandler_->doCatch(configuration_->executablePath_.string(), Core::getLogPathString() + "orxonox_crash.log");
+        this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
 
         // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
-        OutputHandler::getOutStream().setLogPath(Core::getLogPathString());
+        OutputHandler::getOutStream().setLogPath(PathConfig::getLogPathString());
 
         // Parse additional options file now that we know its path
@@ -343,5 +259,5 @@
 
         // initialise Tcl
-        this->tclBind_.reset(new TclBind(Core::getDataPathString()));
+        this->tclBind_.reset(new TclBind(PathConfig::getDataPathString()));
         this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
 
@@ -456,54 +372,4 @@
     }
 
-    /*static*/ void Core::tsetExternalDataPath(const std::string& path)
-    {
-        getInstance().configuration_->tsetExternalDataPath(path);
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getDataPath()
-    {
-        return getInstance().configuration_->dataPath_;
-    }
-    /*static*/ std::string Core::getDataPathString()
-    {
-        return getInstance().configuration_->dataPath_.string() + '/';
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getExternalDataPath()
-    {
-        return getInstance().configuration_->externalDataPath_;
-    }
-    /*static*/ std::string Core::getExternalDataPathString()
-    {
-        return getInstance().configuration_->externalDataPath_.string() + '/';
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getConfigPath()
-    {
-        return getInstance().configuration_->configPath_;
-    }
-    /*static*/ std::string Core::getConfigPathString()
-    {
-        return getInstance().configuration_->configPath_.string() + '/';
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getLogPath()
-    {
-        return getInstance().configuration_->logPath_;
-    }
-    /*static*/ std::string Core::getLogPathString()
-    {
-        return getInstance().configuration_->logPath_.string() + '/';
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getRootPath()
-    {
-        return getInstance().configuration_->rootPath_;
-    }
-    /*static*/ std::string Core::getRootPathString()
-    {
-        return getInstance().configuration_->rootPath_.string() + '/';
-    }
-
     /**
     @note
@@ -552,174 +418,4 @@
     }
 
-    /**
-    @brief
-        Retrievs the executable path and sets all hard coded fixed path (currently only the module path)
-        Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
-        If found it means that this is not an installed run, hence we
-        don't write the logs and config files to ~/.orxonox
-    @throw
-        GeneralException
-    */
-    void Core::setFixedPaths()
-    {
-        //////////////////////////
-        // FIND EXECUTABLE PATH //
-        //////////////////////////
-
-#ifdef ORXONOX_PLATFORM_WINDOWS
-        // get executable module
-        TCHAR buffer[1024];
-        if (GetModuleFileName(NULL, buffer, 1024) == 0)
-            ThrowException(General, "Could not retrieve executable path.");
-
-#elif defined(ORXONOX_PLATFORM_APPLE)
-        char buffer[1024];
-        unsigned long path_len = 1023;
-        if (_NSGetExecutablePath(buffer, &path_len))
-            ThrowException(General, "Could not retrieve executable path.");
-
-#else /* Linux */
-        /* written by Nicolai Haehnle <prefect_@gmx.net> */
-
-        /* Get our PID and build the name of the link in /proc */
-        char linkname[64]; /* /proc/<pid>/exe */
-        if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0)
-        {
-            /* This should only happen on large word systems. I'm not sure
-               what the proper response is here.
-               Since it really is an assert-like condition, aborting the
-               program seems to be in order. */
-            assert(false);
-        }
-
-        /* Now read the symbolic link */
-        char buffer[1024];
-        int ret;
-        ret = readlink(linkname, buffer, 1024);
-        /* In case of an error, leave the handling up to the caller */
-        if (ret == -1)
-            ThrowException(General, "Could not retrieve executable path.");
-
-        /* Ensure proper NUL termination */
-        buffer[ret] = 0;
-#endif
-
-        configuration_->executablePath_ = boost::filesystem::path(buffer);
-#ifndef ORXONOX_PLATFORM_APPLE
-        configuration_->executablePath_ = configuration_->executablePath_.branch_path(); // remove executable name
-#endif
-
-        /////////////////////
-        // SET MODULE PATH //
-        /////////////////////
-
-        if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me"))
-        {
-            COUT(1) << "Running from the build tree." << std::endl;
-            Core::bDevRun_ = true;
-            configuration_->modulePath_ = specialConfig::moduleDevDirectory;
-        }
-        else
-        {
-
-#ifdef INSTALL_COPYABLE // --> relative paths
-
-            // Also set the root path
-            boost::filesystem::path relativeExecutablePath(specialConfig::defaultRuntimePath);
-            configuration_->rootPath_ = configuration_->executablePath_;
-            while (!boost::filesystem::equivalent(configuration_->rootPath_ / relativeExecutablePath, configuration_->executablePath_)
-                   && !configuration_->rootPath_.empty())
-                configuration_->rootPath_ = configuration_->rootPath_.branch_path();
-            if (configuration_->rootPath_.empty())
-                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
-
-            // Module path is fixed as well
-            configuration_->modulePath_ = configuration_->rootPath_ / specialConfig::defaultModulePath;
-
-#else
-
-            // There is no root path, so don't set it at all
-            // Module path is fixed as well
-            configuration_->modulePath_ = specialConfig::moduleInstallDirectory;
-
-#endif
-        }
-    }
-
-    /**
-    @brief
-        Sets config, log and media path and creates folders if necessary.
-    @throws
-        GeneralException
-    */
-    void Core::setConfigurablePaths()
-    {
-        if (Core::isDevelopmentRun())
-        {
-            configuration_->dataPath_  = specialConfig::dataDevDirectory;
-            configuration_->externalDataPath_ = specialConfig::externalDataDevDirectory;
-            configuration_->configPath_ = specialConfig::configDevDirectory;
-            configuration_->logPath_    = specialConfig::logDevDirectory;
-        }
-        else
-        {
-
-#ifdef INSTALL_COPYABLE // --> relative paths
-
-            // Using paths relative to the install prefix, complete them
-            configuration_->dataPath_   = configuration_->rootPath_ / specialConfig::defaultDataPath;
-            configuration_->configPath_ = configuration_->rootPath_ / specialConfig::defaultConfigPath;
-            configuration_->logPath_    = configuration_->rootPath_ / specialConfig::defaultLogPath;
-
-#else
-
-            configuration_->dataPath_  = specialConfig::dataInstallDirectory;
-
-            // Get user directory
-#  ifdef ORXONOX_PLATFORM_UNIX /* Apple? */
-            char* userDataPathPtr(getenv("HOME"));
-#  else
-            char* userDataPathPtr(getenv("APPDATA"));
-#  endif
-            if (userDataPathPtr == NULL)
-                ThrowException(General, "Could not retrieve user data path.");
-            boost::filesystem::path userDataPath(userDataPathPtr);
-            userDataPath /= ".orxonox";
-
-            configuration_->configPath_ = userDataPath / specialConfig::defaultConfigPath;
-            configuration_->logPath_    = userDataPath / specialConfig::defaultLogPath;
-
-#endif
-
-        }
-
-        // Option to put all the config and log files in a separate folder
-        if (!CommandLine::getArgument("writingPathSuffix")->hasDefaultValue())
-        {
-            std::string directory(CommandLine::getValue("writingPathSuffix").getString());
-            configuration_->configPath_ = configuration_->configPath_ / directory;
-            configuration_->logPath_    = configuration_->logPath_    / directory;
-        }
-
-        // Create directories to avoid problems when opening files in non existent folders.
-        std::vector<std::pair<boost::filesystem::path, std::string> > directories;
-        directories.push_back(std::make_pair(boost::filesystem::path(configuration_->configPath_), "config"));
-        directories.push_back(std::make_pair(boost::filesystem::path(configuration_->logPath_), "log"));
-
-        for (std::vector<std::pair<boost::filesystem::path, std::string> >::iterator it = directories.begin();
-            it != directories.end(); ++it)
-        {
-            if (boost::filesystem::exists(it->first) && !boost::filesystem::is_directory(it->first))
-            {
-                ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
-                                         Please remove " + it->first.string());
-            }
-            if (boost::filesystem::create_directories(it->first)) // function may not return true at all (bug?)
-            {
-                COUT(4) << "Created " << it->second << " directory" << std::endl;
-            }
-        }
-    }
-
     void Core::preUpdate(const Clock& time)
     {
Index: code/branches/core5/src/libraries/core/Core.h
===================================================================
--- code/branches/core5/src/libraries/core/Core.h	(revision 5832)
+++ code/branches/core5/src/libraries/core/Core.h	(revision 5836)
@@ -28,13 +28,4 @@
  */
 
-/**
-@file
-@brief
-    Declaration of the Core class.
-@details
-    The Core class is a singleton, only used to configure some variables
-    in the core through the config-file.
-*/
-
 #ifndef _Core_H__
 #define _Core_H__
@@ -55,7 +46,4 @@
     @brief
         The Core class is a singleton used to configure the program basics.
-    @details
-        The class provides information about the data, config and log path.
-        It determines those by the use of platform specific functions.
     @remark
         You should only create this singleton once because it destroys the identifiers!
@@ -85,28 +73,4 @@
             static void  resetLanguage();
 
-            static void tsetExternalDataPath(const std::string& path);
-            //! Returns the path to the data files as boost::filesystem::path
-            static const boost::filesystem::path& getDataPath();
-            //! Returns the path to the external data files as boost::filesystem::path
-            static const boost::filesystem::path& getExternalDataPath();
-            //! Returns the path to the config files as boost::filesystem::path
-            static const boost::filesystem::path& getConfigPath();
-            //! Returns the path to the log files as boost::filesystem::path
-            static const boost::filesystem::path& getLogPath();
-            //! Returns the path to the root folder as boost::filesystem::path
-            static const boost::filesystem::path& getRootPath();
-            //! Returns the path to the data files as std::string
-            static std::string getDataPathString();
-            //! Returns the path to the external data files as std::string
-            static std::string getExternalDataPathString();
-            //! Returns the path to the config files as std::string
-            static std::string getConfigPathString();
-            //! Returns the path to the log files as std::string
-            static std::string getLogPathString();
-            //! Returns the path to the root folder as std::string
-            static std::string getRootPathString();
-
-            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
-
         private:
             Core(const Core&); //!< Don't use (undefined symbol)
@@ -118,9 +82,8 @@
             void unloadGraphics();
 
-            void setFixedPaths();
-            void setConfigurablePaths();
             void setThreadAffinity(int limitToCPU);
 
             // Mind the order for the destruction!
+            scoped_ptr<PathConfig>        pathConfig_;
             scoped_ptr<DynLibManager>     dynLibManager_;
             scoped_ptr<SignalHandler>     signalHandler_;
@@ -138,7 +101,5 @@
             scoped_ptr<GUIManager>        guiManager_;          //!< Interface to GUI
 
-            bool                          bDevRun_;             //!< True for runs in the build directory (not installed)
             bool                          bGraphicsLoaded_;
-
             static Core* singletonPtr_s;
     };
Index: code/branches/core5/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/core5/src/libraries/core/CorePrereqs.h	(revision 5832)
+++ code/branches/core5/src/libraries/core/CorePrereqs.h	(revision 5836)
@@ -151,4 +151,5 @@
     class OgreWindowEventListener;
     class OrxonoxClass;
+    class PathConfig;
     struct ResourceInfo;
     class Shell;
Index: code/branches/core5/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/core5/src/libraries/core/GUIManager.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/GUIManager.cc	(revision 5836)
@@ -55,4 +55,5 @@
 #include "Clock.h"
 #include "LuaState.h"
+#include "PathConfig.h"
 #include "Resource.h"
 
@@ -116,5 +117,5 @@
         // Create our own logger to specify the filepath
         std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
-        ceguiLogger->setLogFilename(Core::getLogPathString() + "cegui.log");
+        ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
         // set the log level according to ours (translate by subtracting 1)
         ceguiLogger->setLoggingLevel(
Index: code/branches/core5/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/core5/src/libraries/core/GraphicsManager.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/GraphicsManager.cc	(revision 5836)
@@ -55,9 +55,9 @@
 #include "ConfigValueIncludes.h"
 #include "CoreIncludes.h"
-#include "Core.h"
 #include "Game.h"
 #include "GameMode.h"
 #include "Loader.h"
 #include "MemoryArchive.h"
+#include "PathConfig.h"
 #include "WindowEventListener.h"
 #include "XMLFile.h"
@@ -102,5 +102,5 @@
 
         // At first, add the root paths of the data directories as resource locations
-        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Core::getDataPathString(), "FileSystem", "dataRoot", false);
+        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getDataPathString(), "FileSystem", "dataRoot", false);
         // Load resources
         resources_.reset(new XMLFile("resources.oxr", "dataRoot"));
@@ -109,7 +109,7 @@
 
         // Only for development runs
-        if (Core::isDevelopmentRun())
-        {
-            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Core::getExternalDataPathString(), "FileSystem", "externalDataRoot", false);
+        if (PathConfig::isDevelopmentRun())
+        {
+            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getExternalDataPathString(), "FileSystem", "externalDataRoot", false);
             extResources_.reset(new XMLFile("resources.oxr", "externalDataRoot"));
             extResources_->setLuaSupport(false);
@@ -135,5 +135,5 @@
         // Undeclare the resources
         Loader::unload(resources_.get());
-        if (Core::isDevelopmentRun())
+        if (PathConfig::isDevelopmentRun())
             Loader::unload(extResources_.get());
     }
@@ -246,6 +246,6 @@
         }
 
-        boost::filesystem::path ogreConfigFilepath(Core::getConfigPath() / this->ogreConfigFile_);
-        boost::filesystem::path ogreLogFilepath(Core::getLogPath() / this->ogreLogFile_);
+        boost::filesystem::path ogreConfigFilepath(PathConfig::getConfigPath() / this->ogreConfigFile_);
+        boost::filesystem::path ogreLogFilepath(PathConfig::getLogPath() / this->ogreLogFile_);
 
         // create a new logManager
@@ -422,5 +422,5 @@
         assert(this->renderWindow_);
        
-        this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg");
+        this->renderWindow_->writeContentsToTimestampedFile(PathConfig::getLogPathString() + "screenShot_", ".jpg");
     }
 }
Index: code/branches/core5/src/libraries/core/Language.cc
===================================================================
--- code/branches/core5/src/libraries/core/Language.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/Language.cc	(revision 5836)
@@ -39,4 +39,5 @@
 #include "util/Debug.h"
 #include "Core.h"
+#include "PathConfig.h"
 
 namespace orxonox
@@ -200,5 +201,5 @@
         COUT(4) << "Read default language file." << std::endl;
 
-        boost::filesystem::path filepath(Core::getConfigPath() / getFilename(this->defaultLanguage_));
+        boost::filesystem::path filepath(PathConfig::getConfigPath() / getFilename(this->defaultLanguage_));
 
         // This creates the file if it's not existing
@@ -249,5 +250,5 @@
         COUT(4) << "Read translated language file (" << Core::getLanguage() << ")." << std::endl;
 
-        boost::filesystem::path filepath(Core::getConfigPath() / getFilename(Core::getLanguage()));
+        boost::filesystem::path filepath(PathConfig::getConfigPath() / getFilename(Core::getLanguage()));
 
         // Open the file
@@ -303,5 +304,5 @@
         COUT(4) << "Language: Write default language file." << std::endl;
 
-        boost::filesystem::path filepath(Core::getConfigPath() / getFilename(this->defaultLanguage_));
+        boost::filesystem::path filepath(PathConfig::getConfigPath() / getFilename(this->defaultLanguage_));
 
         // Open the file
Index: code/branches/core5/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/core5/src/libraries/core/LuaState.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/LuaState.cc	(revision 5836)
@@ -37,5 +37,4 @@
 
 #include "util/Debug.h"
-#include "Core.h"
 #include "Resource.h"
 #include "ToluaBindCore.h"
Index: code/branches/core5/src/libraries/core/PathConfig.cc
===================================================================
--- code/branches/core5/src/libraries/core/PathConfig.cc	(revision 5836)
+++ code/branches/core5/src/libraries/core/PathConfig.cc	(revision 5836)
@@ -0,0 +1,323 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "PathConfig.h"
+
+#include <cassert>
+#include <cstdlib>
+#include <cstdio>
+#include <vector>
+#include <boost/version.hpp>
+#include <boost/filesystem.hpp>
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#  endif
+#  include <windows.h>
+#  undef min
+#  undef max
+#elif defined(ORXONOX_PLATFORM_APPLE)
+#  include <sys/param.h>
+#  include <mach-o/dyld.h>
+#else /* Linux */
+#  include <sys/types.h>
+#  include <unistd.h>
+#endif
+
+#include "SpecialConfig.h"
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "CommandLine.h"
+
+// Boost 1.36 has some issues with deprecated functions that have been omitted
+#if (BOOST_VERSION == 103600)
+#  define BOOST_LEAF_FUNCTION filename
+#else
+#  define BOOST_LEAF_FUNCTION leaf
+#endif
+
+namespace orxonox
+{
+    namespace bf = boost::filesystem;
+
+    //! Static pointer to the singleton
+    PathConfig* PathConfig::singletonPtr_s  = 0;
+
+    SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
+    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
+
+    PathConfig::PathConfig()
+        : rootPath_(*(new bf::path()))
+        , executablePath_(*(new bf::path()))
+        , modulePath_(*(new bf::path()))
+        , dataPath_(*(new bf::path()))
+        , externalDataPath_(*(new bf::path()))
+        , configPath_(*(new bf::path()))
+        , logPath_(*(new bf::path()))
+        , bDevRun_(false)
+    {
+        //////////////////////////
+        // FIND EXECUTABLE PATH //
+        //////////////////////////
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+        // get executable module
+        TCHAR buffer[1024];
+        if (GetModuleFileName(NULL, buffer, 1024) == 0)
+            ThrowException(General, "Could not retrieve executable path.");
+
+#elif defined(ORXONOX_PLATFORM_APPLE)
+        char buffer[1024];
+        unsigned long path_len = 1023;
+        if (_NSGetExecutablePath(buffer, &path_len))
+            ThrowException(General, "Could not retrieve executable path.");
+
+#else /* Linux */
+        /* written by Nicolai Haehnle <prefect_@gmx.net> */
+
+        /* Get our PID and build the name of the link in /proc */
+        char linkname[64]; /* /proc/<pid>/exe */
+        if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0)
+        {
+            /* This should only happen on large word systems. I'm not sure
+               what the proper response is here.
+               Since it really is an assert-like condition, aborting the
+               program seems to be in order. */
+            assert(false);
+        }
+
+        /* Now read the symbolic link */
+        char buffer[1024];
+        int ret;
+        ret = readlink(linkname, buffer, 1024);
+        /* In case of an error, leave the handling up to the caller */
+        if (ret == -1)
+            ThrowException(General, "Could not retrieve executable path.");
+
+        /* Ensure proper NUL termination */
+        buffer[ret] = 0;
+#endif
+
+        executablePath_ = bf::path(buffer);
+#ifndef ORXONOX_PLATFORM_APPLE
+        executablePath_ = executablePath_.branch_path(); // remove executable name
+#endif
+
+        /////////////////////
+        // SET MODULE PATH //
+        /////////////////////
+
+        if (bf::exists(executablePath_ / "orxonox_dev_build.keep_me"))
+        {
+            COUT(1) << "Running from the build tree." << std::endl;
+            PathConfig::bDevRun_ = true;
+            modulePath_ = specialConfig::moduleDevDirectory;
+        }
+        else
+        {
+
+#ifdef INSTALL_COPYABLE // --> relative paths
+
+            // Also set the root path
+            bf::path relativeExecutablePath(specialConfig::defaultRuntimePath);
+            rootPath_ = executablePath_;
+            while (!bf::equivalent(rootPath_ / relativeExecutablePath, executablePath_) && !rootPath_.empty())
+                rootPath_ = rootPath_.branch_path();
+            if (rootPath_.empty())
+                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
+
+            // Module path is fixed as well
+            modulePath_ = rootPath_ / specialConfig::defaultModulePath;
+
+#else
+
+            // There is no root path, so don't set it at all
+            // Module path is fixed as well
+            modulePath_ = specialConfig::moduleInstallDirectory;
+
+#endif
+        }
+    }
+
+    PathConfig::~PathConfig()
+    {
+        delete &rootPath_;
+        delete &executablePath_;
+        delete &modulePath_;
+        delete &dataPath_;
+        delete &externalDataPath_;
+        delete &configPath_;
+        delete &logPath_;
+    }
+
+    void PathConfig::setConfigurablePaths()
+    {
+        if (bDevRun_)
+        {
+            dataPath_         = specialConfig::dataDevDirectory;
+            configPath_       = specialConfig::configDevDirectory;
+            logPath_          = specialConfig::logDevDirectory;
+
+            // Check for data path override by the command line
+            if (!CommandLine::getArgument("externalDataPath")->hasDefaultValue())
+                externalDataPath_ = CommandLine::getValue("externalDataPath").getString();
+            else
+                externalDataPath_ = specialConfig::externalDataDevDirectory;
+        }
+        else
+        {
+
+#ifdef INSTALL_COPYABLE // --> relative paths
+
+            // Using paths relative to the install prefix, complete them
+            dataPath_   = rootPath_ / specialConfig::defaultDataPath;
+            configPath_ = rootPath_ / specialConfig::defaultConfigPath;
+            logPath_    = rootPath_ / specialConfig::defaultLogPath;
+
+#else
+
+            dataPath_  = specialConfig::dataInstallDirectory;
+
+            // Get user directory
+#  ifdef ORXONOX_PLATFORM_UNIX /* Apple? */
+            char* userDataPathPtr(getenv("HOME"));
+#  else
+            char* userDataPathPtr(getenv("APPDATA"));
+#  endif
+            if (userDataPathPtr == NULL)
+                ThrowException(General, "Could not retrieve user data path.");
+            bf::path userDataPath(userDataPathPtr);
+            userDataPath /= ".orxonox";
+
+            configPath_ = userDataPath / specialConfig::defaultConfigPath;
+            logPath_    = userDataPath / specialConfig::defaultLogPath;
+
+#endif
+
+        }
+
+        // Option to put all the config and log files in a separate folder
+        if (!CommandLine::getArgument("writingPathSuffix")->hasDefaultValue())
+        {
+            std::string directory(CommandLine::getValue("writingPathSuffix").getString());
+            configPath_ = configPath_ / directory;
+            logPath_    = logPath_    / directory;
+        }
+
+        // Create directories to avoid problems when opening files in non existent folders.
+        std::vector<std::pair<bf::path, std::string> > directories;
+        directories.push_back(std::make_pair(bf::path(configPath_), "config"));
+        directories.push_back(std::make_pair(bf::path(logPath_), "log"));
+
+        for (std::vector<std::pair<bf::path, std::string> >::iterator it = directories.begin();
+            it != directories.end(); ++it)
+        {
+            if (bf::exists(it->first) && !bf::is_directory(it->first))
+            {
+                ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
+                                         Please remove " + it->first.string());
+            }
+            if (bf::create_directories(it->first)) // function may not return true at all (bug?)
+            {
+                COUT(4) << "Created " << it->second << " directory" << std::endl;
+            }
+        }
+    }
+
+    std::vector<std::string> PathConfig::getModulePaths()
+    {
+        std::vector<std::string> modulePaths;
+
+        // We search for helper files with the following extension
+        std::string moduleextension = specialConfig::moduleExtension;
+        size_t moduleextensionlength = moduleextension.size();
+
+        // Add that path to the PATH variable in case a module depends on another one
+        std::string pathVariable = getenv("PATH");
+        putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + modulePath_.string()).c_str()));
+
+        boost::filesystem::directory_iterator file(modulePath_);
+        boost::filesystem::directory_iterator end;
+
+        // Iterate through all files
+        while (file != end)
+        {
+            std::string filename = file->BOOST_LEAF_FUNCTION();
+
+            // Check if the file ends with the exension in question
+            if (filename.size() > moduleextensionlength)
+            {
+                if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
+                {
+                    // We've found a helper file
+                    std::string library = filename.substr(0, filename.size() - moduleextensionlength);
+                    modulePaths.push_back((modulePath_ / library).string());
+                }
+            }
+            ++file;
+        }
+
+        return modulePaths;
+    }
+
+    /*static*/ std::string PathConfig::getRootPathString()
+    {
+        return getInstance().rootPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getExecutablePathString()
+    {
+        return getInstance().executablePath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getDataPathString()
+    {
+        return getInstance().dataPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getExternalDataPathString()
+    {
+        return getInstance().externalDataPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getConfigPathString()
+    {
+        return getInstance().configPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getLogPathString()
+    {
+        return getInstance().logPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getModulePathString()
+    {
+        return getInstance().modulePath_.string() + '/';
+    }
+}
Index: code/branches/core5/src/libraries/core/PathConfig.h
===================================================================
--- code/branches/core5/src/libraries/core/PathConfig.h	(revision 5836)
+++ code/branches/core5/src/libraries/core/PathConfig.h	(revision 5836)
@@ -0,0 +1,136 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _PathConfig_H__
+#define _PathConfig_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+#include "util/Singleton.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        The PathConfig class is a singleton used to configure different paths.
+    @details
+        The class provides information about the data, config, log, executable,
+        root and module path.
+        It determines those by the use of platform specific functions.
+    @remarks
+        Not all paths are always available:
+        - root only when installed copyable
+        - externalData only for development builds in the build tree
+    */
+    class _CoreExport PathConfig : public Singleton<PathConfig>
+    {
+        friend class Singleton<PathConfig>;
+        friend class Core;
+
+        public:
+            /**
+            @brief
+                Retrievs the executable path and sets all hard coded fixed paths (currently only the module path)
+                Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
+                If found it means that this is not an installed run, hence we
+                don't write the logs and config files to ~/.orxonox
+            @throw
+                GeneralException
+            */
+            PathConfig();
+            ~PathConfig();
+
+            //! Returns the path to the root folder as boost::filesystem::path
+            static const boost::filesystem::path& getRootPath()
+                { return getInstance().rootPath_; }
+            //! Returns the path to the executable folder as boost::filesystem::path
+            static const boost::filesystem::path& getExecutablePath()
+                { return getInstance().executablePath_; }
+            //! Returns the path to the data files as boost::filesystem::path
+            static const boost::filesystem::path& getDataPath()
+                { return getInstance().dataPath_; }
+            //! Returns the path to the external data files as boost::filesystem::path
+            static const boost::filesystem::path& getExternalDataPath()
+                { return getInstance().externalDataPath_; }
+            //! Returns the path to the config files as boost::filesystem::path
+            static const boost::filesystem::path& getConfigPath()
+                { return getInstance().configPath_; }
+            //! Returns the path to the log files as boost::filesystem::path
+            static const boost::filesystem::path& getLogPath()
+                { return getInstance().logPath_; }
+            //! Returns the path to the modules as boost::filesystem::path
+            static const boost::filesystem::path& getModulePath()
+                { return getInstance().modulePath_; }
+
+            //! Returns the path to the root folder as std::string
+            static std::string getRootPathString();
+            //! Returns the path to the executable folder as std::string
+            static std::string getExecutablePathString();
+            //! Returns the path to the data files as std::string
+            static std::string getDataPathString();
+            //! Returns the path to the external data files as std::string
+            static std::string getExternalDataPathString();
+            //! Returns the path to the config files as std::string
+            static std::string getConfigPathString();
+            //! Returns the path to the log files as std::string
+            static std::string getLogPathString();
+            //! Returns the path to the modules as std::string
+            static std::string getModulePathString();
+
+            //! Return trrue for runs in the build directory (not installed)
+            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
+
+        private:
+            PathConfig(const PathConfig&); //!< Don't use (undefined symbol)
+
+            /**
+            @brief
+                Sets config, log and media path and creates the folders if necessary.
+            @throws
+                GeneralException
+            */
+            void setConfigurablePaths();
+            //! Returns a list with all modules declared by a *.module file in the module folder.
+            std::vector<std::string> getModulePaths();
+
+            //! Path to the parent directory of the ones above if program was installed with relativ paths
+            boost::filesystem::path& rootPath_;
+            boost::filesystem::path& executablePath_;        //!< Path to the executable
+            boost::filesystem::path& modulePath_;            //!< Path to the modules
+            boost::filesystem::path& dataPath_;              //!< Path to the data files folder
+            boost::filesystem::path& externalDataPath_;      //!< Path to the external data files folder
+            boost::filesystem::path& configPath_;            //!< Path to the config files folder
+            boost::filesystem::path& logPath_;               //!< Path to the log files folder
+
+            bool                     bDevRun_;               //!< True for runs in the build directory (not installed)
+            static PathConfig* singletonPtr_s;
+    };
+}
+
+#endif /* _PathConfig_H__ */
Index: code/branches/core5/src/libraries/core/TclBind.cc
===================================================================
--- code/branches/core5/src/libraries/core/TclBind.cc	(revision 5832)
+++ code/branches/core5/src/libraries/core/TclBind.cc	(revision 5836)
@@ -39,5 +39,5 @@
 #include "CommandExecutor.h"
 #include "ConsoleCommand.h"
-#include "Core.h"
+#include "PathConfig.h"
 #include "TclThreadManager.h"
 
@@ -123,8 +123,8 @@
     {
 #ifdef DEPENDENCY_PACKAGE_ENABLE
-        if (Core::isDevelopmentRun())
+        if (PathConfig::isDevelopmentRun())
             return (std::string(specialConfig::dependencyLibraryDirectory) + "/tcl");
         else
-            return (Core::getRootPathString() + "lib/tcl");
+            return (PathConfig::getRootPathString() + "lib/tcl");
 #else
         return "";
Index: code/branches/core5/src/libraries/tools/ResourceLocation.cc
===================================================================
--- code/branches/core5/src/libraries/tools/ResourceLocation.cc	(revision 5832)
+++ code/branches/core5/src/libraries/tools/ResourceLocation.cc	(revision 5836)
@@ -33,6 +33,6 @@
 
 #include "util/Exception.h"
-#include "core/Core.h"
 #include "core/CoreIncludes.h"
+#include "core/PathConfig.h"
 #include "core/XMLFile.h"
 #include "core/XMLPort.h"
@@ -71,9 +71,10 @@
 
         // Find the path
-        boost::filesystem::path path;
-        if (boost::filesystem::exists(Core::getDataPath() / this->getPath()))
-            path = Core::getDataPath() / this->getPath();
-        else if (Core::isDevelopmentRun() && boost::filesystem::exists(Core::getExternalDataPath() / this->getPath()))
-            path = Core::getExternalDataPath() / this->getPath();
+        namespace bf = boost::filesystem;
+        bf::path path;
+        if (bf::exists(PathConfig::getDataPath() / this->getPath()))
+            path = PathConfig::getDataPath() / this->getPath();
+        else if (PathConfig::isDevelopmentRun() && bf::exists(PathConfig::getExternalDataPath() / this->getPath()))
+            path = PathConfig::getExternalDataPath() / this->getPath();
         else
         {
Index: code/branches/core5/src/modules/gamestates/GSGraphics.cc
===================================================================
--- code/branches/core5/src/modules/gamestates/GSGraphics.cc	(revision 5832)
+++ code/branches/core5/src/modules/gamestates/GSGraphics.cc	(revision 5836)
@@ -39,5 +39,4 @@
 #include "core/CommandExecutor.h"
 #include "core/ConsoleCommand.h"
-#include "core/Core.h"
 #include "core/Game.h"
 #include "core/GUIManager.h"
Index: code/branches/core5/src/modules/gamestates/GSLevel.cc
===================================================================
--- code/branches/core5/src/modules/gamestates/GSLevel.cc	(revision 5832)
+++ code/branches/core5/src/modules/gamestates/GSLevel.cc	(revision 5836)
@@ -41,5 +41,4 @@
 #include "core/Game.h"
 #include "core/GameMode.h"
-#include "core/Core.h"
 #include "core/GraphicsManager.h"
 #include "core/GUIManager.h"
Index: code/branches/core5/src/orxonox/Level.cc
===================================================================
--- code/branches/core5/src/orxonox/Level.cc	(revision 5832)
+++ code/branches/core5/src/orxonox/Level.cc	(revision 5836)
@@ -30,5 +30,4 @@
 
 #include "util/Math.h"
-#include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/Loader.h"
Index: code/branches/core5/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/core5/src/orxonox/LevelManager.cc	(revision 5832)
+++ code/branches/core5/src/orxonox/LevelManager.cc	(revision 5836)
@@ -34,5 +34,4 @@
 #include "core/CommandLine.h"
 #include "core/ConfigValueIncludes.h"
-#include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/Loader.h"
Index: code/branches/core5/src/orxonox/sound/SoundBase.cc
===================================================================
--- code/branches/core5/src/orxonox/sound/SoundBase.cc	(revision 5832)
+++ code/branches/core5/src/orxonox/sound/SoundBase.cc	(revision 5836)
@@ -35,5 +35,4 @@
 
 #include "util/Math.h"
-#include "core/Core.h"
 #include "core/Resource.h"
 #include "worldentities/WorldEntity.h"
