Index: code/branches/buildsystem3/src/core/CMakeLists.txt
===================================================================
--- code/branches/buildsystem3/src/core/CMakeLists.txt	(revision 2667)
+++ code/branches/buildsystem3/src/core/CMakeLists.txt	(revision 2685)
@@ -70,5 +70,12 @@
 IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
   # Get around displaying a few hundred lines of warning code
-  SET_SOURCE_FILES_PROPERTIES(ArgumentCompletionFunctions.cc PROPERTIES COMPILE_FLAGS "-w")
+  SET_SOURCE_FILES_PROPERTIES(
+    ArgumentCompletionFunctions.cc
+    CommandLine.cc
+    ConfigFileManager.cc
+    Language.cc
+    LuaBind.cc
+    input/KeyBinder.cc
+    PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
 ENDIF()
 
Index: code/branches/buildsystem3/src/core/CommandLine.cc
===================================================================
--- code/branches/buildsystem3/src/core/CommandLine.cc	(revision 2667)
+++ code/branches/buildsystem3/src/core/CommandLine.cc	(revision 2685)
@@ -29,6 +29,8 @@
 #include "CommandLine.h"
 
+#include <boost/filesystem.hpp>
 #include "util/String.h"
 #include "util/SubString.h"
+#include "Core.h"
 
 namespace orxonox
@@ -299,9 +301,12 @@
         this->_parse(args);
 
+        std::string filename = CommandLine::getValue("optionsFile").getString();
+        boost::filesystem::path folder(Core::getConfigPath());
+        boost::filesystem::path filepath(folder/filename);
+
         // look for additional arguments in given file or start.ini as default
         // They will not overwrite the arguments given directly
         std::ifstream file;
-        std::string filename = CommandLine::getValue("optionsFile").getString();
-        file.open(filename.c_str());
+        file.open(filepath.native_file_string().c_str());
         args.clear();
         if (file)
Index: code/branches/buildsystem3/src/core/ConfigFileManager.cc
===================================================================
--- code/branches/buildsystem3/src/core/ConfigFileManager.cc	(revision 2667)
+++ code/branches/buildsystem3/src/core/ConfigFileManager.cc	(revision 2685)
@@ -30,8 +30,11 @@
 
 #include <cassert>
+#include <boost/filesystem.hpp>
+
 #include "util/Convert.h"
 #include "util/String.h"
 #include "ConsoleCommand.h"
 #include "ConfigValueContainer.h"
+#include "Core.h"
 
 namespace orxonox
@@ -223,12 +226,14 @@
         this->clear();
 
+        boost::filesystem::path filepath(Core::getConfigPath() + "/" + this->filename_);
+
         // This creates the config file if it's not existing
         std::ofstream createFile;
-        createFile.open(this->filename_.c_str(), std::fstream::app);
+        createFile.open(filepath.native_file_string().c_str(), std::fstream::app);
         createFile.close();
 
         // Open the file
         std::ifstream file;
-        file.open(this->filename_.c_str(), std::fstream::in);
+        file.open(filepath.native_file_string().c_str(), std::fstream::in);
 
         if (!file.is_open())
@@ -337,6 +342,8 @@
     void ConfigFile::save() const
     {
+        boost::filesystem::path filepath(Core::getConfigPath() + "/" + this->filename_);
+
         std::ofstream file;
-        file.open(this->filename_.c_str(), std::fstream::out);
+        file.open(filepath.native_file_string().c_str(), std::fstream::out);
         file.setf(std::ios::fixed, std::ios::floatfield);
         file.precision(6);
Index: code/branches/buildsystem3/src/core/Core.cc
===================================================================
--- code/branches/buildsystem3/src/core/Core.cc	(revision 2667)
+++ code/branches/buildsystem3/src/core/Core.cc	(revision 2685)
@@ -37,4 +37,6 @@
 #include "CoreIncludes.h"
 #include "ConfigValueIncludes.h"
+#include "LuaBind.h"
+#include "CommandLine.h"
 
 namespace orxonox
@@ -46,5 +48,11 @@
     bool Core::bIsMaster_s      = false;
 
+    bool Core::isDevBuild_s     = false;
+    std::string Core::configPath_s(ORXONOX_CONFIG_INSTALL_PATH); // from OrxonoxConfig.h
+    std::string Core::logPath_s   (ORXONOX_LOG_INSTALL_PATH);    // from OrxonoxConfig.h
+
     Core* Core::singletonRef_s = 0;
+
+    SetCommandLineArgument(mediaPath, "").information("PATH");
 
     /**
@@ -58,7 +66,17 @@
         assert(Core::singletonRef_s == 0);
         Core::singletonRef_s = this;
+
         this->bInitializeRandomNumberGenerator_ = false;
-
         this->setConfigValues();
+
+        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
+        OutputHandler::getOutStream().setLogPath(Core::logPath_s);
+
+        // Possible media path override by the command line
+        if (!CommandLine::getArgument("mediaPath")->hasDefaultValue())
+        {
+            std::string mediaPath = CommandLine::getValue("mediaPath");
+            Core::tsetMediaPath(mediaPath);
+        }
     }
 
@@ -77,9 +95,31 @@
     void Core::setConfigValues()
     {
-        SetConfigValue(softDebugLevelConsole_, 3).description("The maximal level of debug output shown in the console").callback(this, &Core::debugLevelChanged);
-        SetConfigValue(softDebugLevelLogfile_, 3).description("The maximal level of debug output shown in the logfile").callback(this, &Core::debugLevelChanged);
-        SetConfigValue(softDebugLevelShell_, 1).description("The maximal level of debug output shown in the ingame shell").callback(this, &Core::debugLevelChanged);
+#ifdef NDEBUG
+        const unsigned int defaultLevelConsole = 1;
+        const unsigned int defaultLevelLogfile = 3;
+        const unsigned int defaultLevelShell   = 1;
+#else
+        const unsigned int defaultLevelConsole = 3;
+        const unsigned int defaultLevelLogfile = 4;
+        const unsigned int defaultLevelShell   = 3;
+#endif
+        SetConfigValue(softDebugLevelConsole_, defaultLevelConsole)
+            .description("The maximal level of debug output shown in the console").callback(this, &Core::debugLevelChanged);
+        SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile)
+            .description("The maximal level of debug output shown in the logfile").callback(this, &Core::debugLevelChanged);
+        SetConfigValue(softDebugLevelShell_, defaultLevelShell)
+            .description("The maximal level of debug output shown in the ingame shell").callback(this, &Core::debugLevelChanged);
+
         SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text").callback(this, &Core::languageChanged);
         SetConfigValue(bInitializeRandomNumberGenerator_, true).description("If true, all random actions are different each time you start the game").callback(this, &Core::initializeRandomNumberGenerator);
+
+        // Media path (towards config and log path) is ini-configurable
+        const char* defaultMediaPath = ORXONOX_MEDIA_INSTALL_PATH;
+        if (Core::isDevBuild())
+            defaultMediaPath = ORXONOX_MEDIA_DEV_PATH;
+
+        SetConfigValue(mediaPath_, defaultMediaPath)
+            .description("Relative path to the game data.").callback(this, &Core::mediaPathChanged);
+
     }
 
@@ -109,4 +149,22 @@
         // Read the translation file after the language was configured
         Language::getLanguage().readTranslatedLanguageFile();
+    }
+
+    /**
+    @brief
+        Callback function if the media path has changed.
+    */
+    void Core::mediaPathChanged()
+    {
+        if (mediaPath_ != "" && mediaPath_[mediaPath_.size() - 1] != '/')
+        {
+            ModifyConfigValue(mediaPath_, set, mediaPath_ + "/");
+        }
+
+        if (mediaPath_ == "")
+        {
+            ModifyConfigValue(mediaPath_, set, "/");
+            COUT(2) << "Warning: Data path set to \"/\", is that really correct?" << std::endl;
+        }
     }
 
@@ -177,4 +235,22 @@
     }
 
+    /**
+    @brief
+        Temporary sets the media path
+    @param path
+        The new media path
+    */
+    void Core::_tsetMediaPath(const std::string& path)
+    {
+        if (*path.end() != '/' && *path.end() != '\\')
+        {
+            ModifyConfigValue(mediaPath_, tset, path + "/");
+        }
+        else
+        {
+            ModifyConfigValue(mediaPath_, tset, path);
+        }
+    }
+
     void Core::initializeRandomNumberGenerator()
     {
@@ -187,3 +263,13 @@
         }
     }
+
+    /*static*/ void Core::setDevBuild()
+    {
+        // Be careful never to call this function before main()!
+
+        Core::isDevBuild_s = true;
+        // Constants taken from OrxonoxConfig.h
+        Core::configPath_s = ORXONOX_CONFIG_DEV_PATH;
+        Core::logPath_s    = ORXONOX_LOG_DEV_PATH;
+    }
 }
Index: code/branches/buildsystem3/src/core/Core.h
===================================================================
--- code/branches/buildsystem3/src/core/Core.h	(revision 2667)
+++ code/branches/buildsystem3/src/core/Core.h	(revision 2685)
@@ -44,4 +44,7 @@
 #include "util/OutputHandler.h"
 
+// Only allow main to access setDevBuild, so we need a forward declaration
+int main(int, char**);
+
 namespace orxonox
 {
@@ -49,10 +52,10 @@
     class _CoreExport Core : public OrxonoxClass
     {
+        friend int ::main(int, char**); // sets isDevBuild_s
+
         public:
             Core();
             ~Core();
             void setConfigValues();
-            void debugLevelChanged();
-            void languageChanged();
 
             static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
@@ -62,4 +65,13 @@
             static const std::string& getLanguage();
             static void  resetLanguage();
+
+            static bool isDevBuild() { return Core::isDevBuild_s; }
+
+            static const std::string& getMediaPath()
+            { assert(singletonRef_s); return singletonRef_s->mediaPath_; }
+            static void tsetMediaPath(const std::string& path)
+            { assert(singletonRef_s); singletonRef_s->_tsetMediaPath(path); }
+            static const std::string& getConfigPath() { return configPath_s; }
+            static const std::string& getLogPath()    { return logPath_s; }
 
             // fast access global variables.
@@ -79,4 +91,10 @@
             void resetLanguageIntern();
             void initializeRandomNumberGenerator();
+            void debugLevelChanged();
+            void languageChanged();
+            void mediaPathChanged();
+            void _tsetMediaPath(const std::string& path);
+
+            static void setDevBuild();
 
             int softDebugLevel_;                            //!< The debug level
@@ -85,5 +103,6 @@
             int softDebugLevelShell_;                       //!< The debug level for the ingame shell
             std::string language_;                          //!< The language
-            bool bInitializeRandomNumberGenerator_;          //!< If true, srand(time(0)) is called
+            bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
+            std::string mediaPath_;                         //!< Path to the data/media file folder
 
             static bool bShowsGraphics_s;                   //!< global variable that tells whether to show graphics
@@ -93,4 +112,8 @@
             static bool bIsMaster_s;
 
+            static bool isDevBuild_s;                       //!< True for builds in the build directory (not installed)
+            static std::string configPath_s;                //!< Path to the config file folder
+            static std::string logPath_s;                   //!< Path to the log file folder
+
             static Core* singletonRef_s;
     };
Index: code/branches/buildsystem3/src/core/Language.cc
===================================================================
--- code/branches/buildsystem3/src/core/Language.cc	(revision 2667)
+++ code/branches/buildsystem3/src/core/Language.cc	(revision 2685)
@@ -35,4 +35,5 @@
 
 #include <fstream>
+#include <boost/filesystem.hpp>
 
 #include "Core.h"
@@ -205,12 +206,15 @@
         COUT(4) << "Read default language file." << std::endl;
 
+        boost::filesystem::path folder(Core::getConfigPath());
+        boost::filesystem::path filepath(folder/getFilename(this->defaultLanguage_));
+
         // This creates the file if it's not existing
         std::ofstream createFile;
-        createFile.open(getFilename(this->defaultLanguage_).c_str(), std::fstream::app);
+        createFile.open(filepath.native_file_string().c_str(), std::fstream::app);
         createFile.close();
 
         // Open the file
         std::ifstream file;
-        file.open(getFilename(this->defaultLanguage_).c_str(), std::fstream::in);
+        file.open(filepath.native_file_string().c_str(), std::fstream::in);
 
         if (!file.is_open())
@@ -254,7 +258,10 @@
         COUT(4) << "Read translated language file (" << Core::getLanguage() << ")." << std::endl;
 
+        boost::filesystem::path folder(Core::getConfigPath());
+        boost::filesystem::path filepath(folder/getFilename(Core::getLanguage()));
+
         // Open the file
         std::ifstream file;
-        file.open(getFilename(Core::getLanguage()).c_str(), std::fstream::in);
+        file.open(filepath.native_file_string().c_str(), std::fstream::in);
 
         if (!file.is_open())
@@ -308,7 +315,10 @@
         COUT(4) << "Language: Write default language file." << std::endl;
 
+        boost::filesystem::path folder(Core::getConfigPath());
+        boost::filesystem::path filepath(folder/getFilename(this->defaultLanguage_));
+
         // Open the file
         std::ofstream file;
-        file.open(getFilename(this->defaultLanguage_).c_str(), std::fstream::out);
+        file.open(filepath.native_file_string().c_str(), std::fstream::out);
 
         if (!file.is_open())
Index: code/branches/buildsystem3/src/core/LuaBind.cc
===================================================================
--- code/branches/buildsystem3/src/core/LuaBind.cc	(revision 2667)
+++ code/branches/buildsystem3/src/core/LuaBind.cc	(revision 2685)
@@ -37,8 +37,10 @@
 }
 #include <tolua/tolua++.h>
-
+#include <boost/filesystem.hpp>
+
+#include "util/String.h"
+#include "util/Debug.h"
 #include "ToluaBindCore.h"
-#include "util/String.h"
-#include "CoreIncludes.h"
+#include "Core.h"
 
 namespace orxonox
@@ -50,4 +52,6 @@
     assert(LuaBind::singletonRef_s == 0);
     LuaBind::singletonRef_s = this;
+
+    this->includePath_ = Core::getMediaPath();
 
     luaState_ = lua_open();
@@ -82,7 +86,9 @@
   void LuaBind::loadFile(std::string filename, bool luaTags)
   {
+    boost::filesystem::path filepath(filename);
+
     output_ = "";
     std::ifstream file;
-    file.open(filename.c_str(), std::fstream::in);
+    file.open(filepath.native_file_string().c_str(), std::fstream::in);
 
     if (!file.is_open())
Index: code/branches/buildsystem3/src/core/input/KeyBinder.cc
===================================================================
--- code/branches/buildsystem3/src/core/input/KeyBinder.cc	(revision 2667)
+++ code/branches/buildsystem3/src/core/input/KeyBinder.cc	(revision 2685)
@@ -36,4 +36,5 @@
 #include <fstream>
 #include <string>
+#include <boost/filesystem.hpp>
 
 #include "util/Convert.h"
@@ -42,4 +43,5 @@
 #include "core/CoreIncludes.h"
 #include "core/ConfigFileManager.h"
+#include "core/Core.h"
 #include "InputCommands.h"
 #include "InputManager.h"
@@ -253,7 +255,10 @@
             return;
 
+        boost::filesystem::path folder(Core::getConfigPath());
+        boost::filesystem::path filepath(folder/filename);
+
         // get bindings from default file if filename doesn't exist.
         std::ifstream infile;
-        infile.open(filename.c_str());
+        infile.open(filepath.native_file_string().c_str());
         if (!infile)
         {
