QTfrontend/util/FileEngine.cpp
changeset 8085 6c059add1560
parent 8052 845b5ae03841
child 8098 4efee370e2de
--- a/QTfrontend/util/FileEngine.cpp	Wed Nov 21 11:57:14 2012 +0400
+++ b/QTfrontend/util/FileEngine.cpp	Wed Nov 21 13:33:27 2012 +0400
@@ -2,7 +2,6 @@
  * TODO: add copyright header, determine license
  */
 
-
 #include "hwpacksmounter.h"
 #include "FileEngine.h"
 
@@ -146,10 +145,27 @@
 
 QString FileEngine::fileName(FileName file) const
 {
-    if (file == QAbstractFileEngine::AbsolutePathName)
-        return PHYSFS_getWriteDir();
-
-    return QString("physfs://%1").arg(_filename);
+    switch(file)
+    {
+        case QAbstractFileEngine::AbsolutePathName:
+        {
+            QString s(PHYSFS_getWriteDir());
+            return s;
+        }
+        case QAbstractFileEngine::BaseName:
+        {
+            int l = _filename.lastIndexOf('/');
+            QString s = _filename.mid(l + 1);
+            return s;
+        }
+        case QAbstractFileEngine::DefaultName:
+        case QAbstractFileEngine::AbsoluteName:
+        default:
+        {
+            QString s = "physfs:/" + _filename;
+            return s;
+        }
+    }
 }
 
 QDateTime FileEngine::fileTime(FileTime time) const