More verbose initialization
authorunc0rr
Mon, 10 Jun 2013 21:20:14 +0400
changeset 9170 7c75643d0b66
parent 9169 ef53201e95ec
child 9171 e72f4f37a444
More verbose initialization
QTfrontend/util/FileEngine.cpp
QTfrontend/util/FileEngine.h
--- a/QTfrontend/util/FileEngine.cpp	Mon Jun 10 11:05:10 2013 +0200
+++ b/QTfrontend/util/FileEngine.cpp	Mon Jun 10 21:20:14 2013 +0400
@@ -54,7 +54,7 @@
     }
 
     if (!m_handle) {
-        qWarning("[PHYSFS] Failed to open %s, reason: %s", m_fileName.toUtf8().constData(), PHYSFS_getLastError());
+        qWarning(QString("[PHYSFS] Failed to open %1, reason: %2").arg(m_fileName).arg(FileEngineHandler::errorStr()).toLocal8Bit().constData());
         return false;
     }
 
@@ -310,6 +310,8 @@
 FileEngineHandler::FileEngineHandler(char *argv0)
 {
     PHYSFS_init(argv0);
+
+    qDebug(QString("[PHYSFS] Init: %1").arg(errorStr()).toLocal8Bit().constData());
 }
 
 FileEngineHandler::~FileEngineHandler()
@@ -327,20 +329,20 @@
 
 void FileEngineHandler::mount(const QString &path)
 {
-    qDebug(QString("[PHYSFS] Mounting '%1' to '/'").arg(path).toLocal8Bit().data());
     PHYSFS_mount(path.toUtf8().constData(), NULL, 0);
+    qDebug(QString("[PHYSFS] Mounting '%1' to '/': %2").arg(path).arg(errorStr()).toLocal8Bit().constData());
 }
 
 void FileEngineHandler::mount(const QString & path, const QString & mountPoint)
 {
-    qDebug(QString("[PHYSFS] Mounting '%1' to '%2'").arg(path).arg(mountPoint).toLocal8Bit().data());
     PHYSFS_mount(path.toUtf8().constData(), mountPoint.toUtf8().constData(), 0);
+    qDebug(QString("[PHYSFS] Mounting '%1' to '%2': %3").arg(path).arg(mountPoint).arg(errorStr()).toLocal8Bit().data());
 }
 
 void FileEngineHandler::setWriteDir(const QString &path)
 {
-    qDebug(QString("[PHYSFS] Setting write dir to '%1'").arg(path).toLocal8Bit().data());
     PHYSFS_setWriteDir(path.toUtf8().constData());
+    qDebug(QString("[PHYSFS] Setting write dir to '%1': %2").arg(path).arg(errorStr()).toLocal8Bit().data());
 }
 
 void FileEngineHandler::mountPacks()
@@ -348,6 +350,12 @@
     hedgewarsMountPackages();
 }
 
+QString FileEngineHandler::errorStr()
+{
+    QString s = QString::fromUtf8(PHYSFS_getLastError());
+    return s.isEmpty() ? "ok" : s;
+}
+
 
 FileEngineIterator::FileEngineIterator(QDir::Filters filters, const QStringList &nameFilters, const QStringList &entries)
     : QAbstractFileEngineIterator(filters, nameFilters)
--- a/QTfrontend/util/FileEngine.h	Mon Jun 10 11:05:10 2013 +0200
+++ b/QTfrontend/util/FileEngine.h	Mon Jun 10 21:20:14 2013 +0400
@@ -71,6 +71,7 @@
         static void mount(const QString & path, const QString & mountPoint);
         static void setWriteDir(const QString & path);
         static void mountPacks();
+        static QString errorStr();
 
 //    private:
         static const QString scheme;