Index: /trunk/src/lib/shell/shell_completion_plugin.cc
===================================================================
--- /trunk/src/lib/shell/shell_completion_plugin.cc	(revision 7422)
+++ /trunk/src/lib/shell/shell_completion_plugin.cc	(revision 7423)
@@ -31,5 +31,5 @@
 {
   CompletorDefault::CompletorDefault(const MultiType* value)
-  :_value(value)
+      :_value(value)
   { }
 
@@ -87,7 +87,6 @@
 
   CompletorFileSystem::CompletorFileSystem(const std::string& fileExtension,
-                                           const std::string& subDir,
-                                           StartDirectory startDir)
-  : _fileExtension(fileExtension), _startDir(startDir), _subDir(subDir)
+      const std::string& subDir)
+      : _fileExtension(fileExtension), _subDir(subDir)
   {  }
 
@@ -95,27 +94,57 @@
   void CompletorFileSystem::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const
   {
+    OS::Directory dir;
+
     if (completionBegin.empty()) // if we do not yet have the beginning of the line, start with the chosen startDir.
     {
-      OS::Directory dir;
-      if (this->_startDir == StartAtDataDir)
-      {
-        dir.open(ResourceManager::getInstance()->getDataDir());
-      }
-
-      else if(this->_startDir == StartAtRoot)
-        dir.open("/");
-      else
-        dir.open(ResourceManager::homeDirCheck("~/"));
-
+      dir.open(ResourceManager::getInstance()->getDataDir() + this->_subDir);
       while(dir)
       {
-        printf("%s\n", "one\n");
-        completionList.push_back(dir.next());
+        completionList.push_back(this->_subDir + "/" + dir.next());
+      }
+    }
+    else
+    {
+      std::string directoryName;
+      std::string::size_type pos = completionBegin.find_last_of("/");
+      if (pos != std::string::npos)
+        directoryName = completionBegin.substr(0, pos);
+
+      dir.open(ResourceManager::getInstance()->getDataDir() + directoryName);
+
+      std::string fileName;
+      std::string currFile;
+      while(dir)
+      {
+        currFile = dir.next();
+        if (currFile[0] == '.')
+         continue;
+
+        if (directoryName.empty())
+          fileName = currFile;
+        else
+          fileName = directoryName + '/' + currFile;
+
+        if (!nocaseCmp(completionBegin, fileName, completionBegin.size())  &&
+             (this->_fileExtension.empty() || fileName.find(this->_fileExtension) != std::string::npos))
+        {
+          printf ("File %s\n", fileName.c_str());
+          completionList.push_back(fileName);
+          continue;
+        }
+        printf("%s\n", (ResourceManager::getInstance()->getDataDir() + fileName).c_str());
+        if (!nocaseCmp(completionBegin, fileName, completionBegin.size()) &&
+             ResourceManager::isDir(ResourceManager::getInstance()->getDataDir() + fileName))
+        {
+          printf("Dir %s\n", fileName.c_str());
+          completionList.push_back(fileName + "/");
+        }
       }
     }
   }
+
   CompletorPlugin* CompletorFileSystem::clone() const
   {
-    return new CompletorFileSystem(this->_fileExtension, this->_subDir, this->_startDir);
+    return new CompletorFileSystem(this->_fileExtension, this->_subDir);
   }
 
Index: /trunk/src/lib/shell/shell_completion_plugin.h
===================================================================
--- /trunk/src/lib/shell/shell_completion_plugin.h	(revision 7422)
+++ /trunk/src/lib/shell/shell_completion_plugin.h	(revision 7423)
@@ -17,22 +17,22 @@
   class CompletorPlugin
   {
-  public:
-    virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const = 0;
-    virtual ~CompletorPlugin() { };
+    public:
+      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const = 0;
+      virtual ~CompletorPlugin() { };
 
-    virtual CompletorPlugin* clone() const = 0;
-  protected:
-    CompletorPlugin() {};
+      virtual CompletorPlugin* clone() const = 0;
+    protected:
+      CompletorPlugin() {};
   };
 
   class CompletorDefault : public CompletorPlugin
   {
-  public:
-    CompletorDefault(const MultiType* value);
-    virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
+    public:
+      CompletorDefault(const MultiType* value);
+      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
 
-    virtual CompletorPlugin* clone() const;
-  private:
-    const MultiType*    _value;
+      virtual CompletorPlugin* clone() const;
+    private:
+      const MultiType*    _value;
   };
 
@@ -41,13 +41,13 @@
   class CompletorStringArray : public CompletorPlugin
   {
-  public:
-    CompletorStringArray(const std::string* stringArray, unsigned int size)
-        : _stringArray(stringArray), _size(size) {};
-    virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
+    public:
+      CompletorStringArray(const std::string* stringArray, unsigned int size)
+          : _stringArray(stringArray), _size(size) {};
+      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
 
-    virtual CompletorPlugin* clone() const;
-  private:
-    const std::string*   _stringArray;
-    unsigned int         _size;
+      virtual CompletorPlugin* clone() const;
+    private:
+      const std::string*   _stringArray;
+      unsigned int         _size;
   };
 
@@ -55,11 +55,11 @@
   class CompletorList : public CompletorPlugin
   {
-  public:
-    CompletorList(const std::list<std::string>* list);
-    virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
-    virtual CompletorPlugin* clone() const;
+    public:
+      CompletorList(const std::list<std::string>* list);
+      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
+      virtual CompletorPlugin* clone() const;
 
-  private:
-    const std::list<std::string>* _list;
+    private:
+      const std::list<std::string>* _list;
   };
 
@@ -69,23 +69,13 @@
   class CompletorFileSystem : public CompletorPlugin
   {
-  public:
-    // Where to search if the completionString is empty.
-    typedef enum
-    {
-      StartAtRoot,
-      StartAtHome,
-      StartAtDataDir,
-    } StartDirectory;
+    public:
+      CompletorFileSystem(const std::string& fileExtension = "",
+                          const std::string& subDir = "");
+      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
+      virtual CompletorPlugin* clone() const;
 
-    CompletorFileSystem(const std::string& fileExtension = "",
-                        const std::string& subDir = "",
-                        StartDirectory startDir = StartAtDataDir);
-    virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const;
-    virtual CompletorPlugin* clone() const;
-
-  private:
-    std::string             _fileExtension;
-    std::string             _subDir;
-    StartDirectory          _startDir;
+    private:
+      std::string             _fileExtension;
+      std::string             _subDir;
   };
 
@@ -96,9 +86,9 @@
   template<typename CLASS> class CompletorTList : public CompletorPlugin
   {
-  public:
-    CompletorTList(const std::list<CLASS*>& completionList);
-    virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin)
-    {};
-    virtual CompletorPlugin* clone() const;
+    public:
+      CompletorTList(const std::list<CLASS*>& completionList);
+      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin)
+      {};
+      virtual CompletorPlugin* clone() const;
   };
 
