--- 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)