Index: /code/branches/console/src/core/ArgumentCompleter.h
===================================================================
--- /code/branches/console/src/core/ArgumentCompleter.h	(revision 1435)
+++ /code/branches/console/src/core/ArgumentCompleter.h	(revision 1436)
@@ -64,5 +64,5 @@
                         return (*this->function_5_)(param1, param2, param3, param4, param5);
                     default:
-                        return (*this->function_0_)();
+                        return std::list<std::pair<std::string, std::string> >();
                 }
             }
Index: /code/branches/console/src/core/ArgumentCompletionFunctions.cc
===================================================================
--- /code/branches/console/src/core/ArgumentCompletionFunctions.cc	(revision 1435)
+++ /code/branches/console/src/core/ArgumentCompletionFunctions.cc	(revision 1436)
@@ -30,4 +30,11 @@
 #include <map>
 
+//#include <stdio.h>
+//#include <stdlib.h>
+//#include <errno.h>
+//#include <sys/types.h>
+//#include <sys/stat.h>
+#include <dirent.h>
+
 #include "ArgumentCompletionFunctions.h"
 #include "CoreIncludes.h"
@@ -36,4 +43,5 @@
 #include "TclThreadManager.h"
 #include "util/String.h"
+#include "util/SubString.h"
 
 namespace orxonox
@@ -44,4 +52,53 @@
         {
             return std::list<std::pair<std::string, std::string> >();
+        }
+
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(files)(const std::string& fragment)
+        {
+            std::list<std::pair<std::string, std::string> > dirlist;
+            std::list<std::pair<std::string, std::string> > filelist;
+
+            SubString tokens(fragment, "/", "", false, '\0', false, '\0', false, '\0', '\0', false, '\0');
+
+            std::string startdirectory = ".";
+            if (fragment.size() > 0 && fragment[fragment.size() - 1] == '/' && tokens.size() > 0)
+                startdirectory = tokens.subSet(0, tokens.size()).join("/");
+            else if (tokens.size() > 1)
+                startdirectory = tokens.subSet(0, tokens.size() - 1).join("/");
+
+std::cout << "startdir: " << startdirectory << std::endl;
+
+            struct stat fileInfo;
+            struct dirent *currentFile;
+            DIR *handler = 0;
+
+            handler = opendir(startdirectory.c_str());
+            if (handler)
+            {
+                while ((currentFile = readdir(handler)) != 0)
+                {
+                    if (strcmp(currentFile->d_name, ".") && strcmp(currentFile->d_name, ".."))
+                    {
+                        std::string path = startdirectory + "/" + currentFile->d_name;
+                        if (stat(path.c_str(), &fileInfo) == -1)
+                        {
+                            closedir(handler);
+                            break;
+                        }
+
+                        if (S_ISREG(fileInfo.st_mode)) // normal file
+                            filelist.push_back(std::pair<std::string, std::string>(getLowercase(path), path));
+                        else if (S_ISDIR(fileInfo.st_mode)) // directory
+                            dirlist.push_back(std::pair<std::string, std::string>(getLowercase(path) + "/", path + "/"));
+                        else // special file
+                            filelist.push_back(std::pair<std::string, std::string>(getLowercase(path), path));
+                    }
+                }
+
+                closedir(handler);
+            }
+
+            filelist.insert(filelist.begin(), dirlist.begin(), dirlist.end());
+            return filelist;
         }
 
@@ -57,5 +114,5 @@
         }
 
-        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalues)(const std::string& classname)
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalues)(const std::string& fragment, const std::string& classname)
         {
             std::list<std::pair<std::string, std::string> > configvalues;
@@ -71,5 +128,5 @@
         }
 
-        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalue)(const std::string& varname, const std::string& classname)
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalue)(const std::string& fragment, const std::string& varname, const std::string& classname)
         {
             std::list<std::pair<std::string, std::string> > oldvalue;
Index: /code/branches/console/src/core/ArgumentCompletionFunctions.h
===================================================================
--- /code/branches/console/src/core/ArgumentCompletionFunctions.h	(revision 1435)
+++ /code/branches/console/src/core/ArgumentCompletionFunctions.h	(revision 1436)
@@ -56,7 +56,8 @@
     {
         ARGUMENT_COMPLETION_FUNCTION_DECLARATION(fallback)();
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(files)(const std::string& fragment);
         ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalueclasses)();
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalues)(const std::string& classname);
-        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalue)(const std::string& varname, const std::string& classname);
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalues)(const std::string& fragment, const std::string& classname);
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalue)(const std::string& fragment, const std::string& varname, const std::string& classname);
         ARGUMENT_COMPLETION_FUNCTION_DECLARATION(tclthreads)();
     }
Index: /code/branches/console/src/core/CommandExecutor.cc
===================================================================
--- /code/branches/console/src/core/CommandExecutor.cc	(revision 1435)
+++ /code/branches/console/src/core/CommandExecutor.cc	(revision 1436)
@@ -557,5 +557,5 @@
         unsigned int lowestIndex = 1 + (CommandExecutor::getEvaluation().functionclass_ != 0);
 
-        for (unsigned int i = CommandExecutor::argumentsGiven() - 2; i >= lowestIndex; --i)
+        for (unsigned int i = CommandExecutor::argumentsGiven() - 1; i >= lowestIndex; --i)
         {
             params[index] = CommandExecutor::getArgument(i);
Index: /code/branches/console/src/core/ConfigFileManager.cc
===================================================================
--- /code/branches/console/src/core/ConfigFileManager.cc	(revision 1435)
+++ /code/branches/console/src/core/ConfigFileManager.cc	(revision 1436)
@@ -42,6 +42,6 @@
     SetConsoleCommandShortcutExtern(reloadConfig);
     SetConsoleCommandShortcutExtern(cleanConfig);
-    SetConsoleCommandShortcutExtern(loadSettings);
-    SetConsoleCommandShortcutExtern(loadKeybindings);
+    SetConsoleCommandShortcutExtern(loadSettings).setArgumentCompleter(0, autocompletion::files());
+    SetConsoleCommandShortcutExtern(loadKeybindings).setArgumentCompleter(0, autocompletion::files());
 
     bool config(const std::string& classname, const std::string& varname, const std::string& value)
Index: /code/branches/console/src/core/ConsoleCommandCompilation.cc
===================================================================
--- /code/branches/console/src/core/ConsoleCommandCompilation.cc	(revision 1435)
+++ /code/branches/console/src/core/ConsoleCommandCompilation.cc	(revision 1436)
@@ -34,11 +34,11 @@
 namespace orxonox
 {
-    SetConsoleCommandShortcutExtern(source);
+    SetConsoleCommandShortcutExtern(source).setArgumentCompleter(0, autocompletion::files());
     SetConsoleCommandShortcutExtern(echo);
     SetConsoleCommandShortcutExtern(puts);
 
-    SetConsoleCommandShortcutExtern(read);
-    SetConsoleCommandShortcutExtern(append);
-    SetConsoleCommandShortcutExtern(write);
+    SetConsoleCommandShortcutExtern(read).setArgumentCompleter(0, autocompletion::files());
+    SetConsoleCommandShortcutExtern(append).setArgumentCompleter(0, autocompletion::files());
+    SetConsoleCommandShortcutExtern(write).setArgumentCompleter(0, autocompletion::files());
 
     SetConsoleCommandShortcutExtern(calculate);
