Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
authorunc0rr
Wed, 21 Nov 2012 13:33:27 +0400
changeset 8085 6c059add1560
parent 8084 e723e95c11f1
child 8086 576ca9b3c7d8
Take care of parameter passed to FileEngine::fileName. Fixes problem with weird paths on windows.
QTfrontend/util/FileEngine.cpp
project_files/hedgewars.pro
--- 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
--- a/project_files/hedgewars.pro	Wed Nov 21 11:57:14 2012 +0400
+++ b/project_files/hedgewars.pro	Wed Nov 21 13:33:27 2012 +0400
@@ -262,7 +262,7 @@
 }
 
 !macx {
-    LIBS += -lSDL -lSDL_mixer
+    LIBS += -lSDL -lSDL_mixer -lSDL_net
     !win32 {
         INCLUDEPATH += /usr/local/include/SDL /usr/include/SDL
     }