Fix PhysFS 3.0.0 deprecation warnings for error reporting
authorWuzzy <Wuzzy2@mail.ru>
Sat, 21 Oct 2017 00:58:01 +0200
changeset 12729 d47ab9245259
parent 12728 288356c20868
child 12730 1a393a59a594
Fix PhysFS 3.0.0 deprecation warnings for error reporting
QTfrontend/util/FileEngine.cpp
--- a/QTfrontend/util/FileEngine.cpp	Fri Oct 20 23:49:52 2017 +0200
+++ b/QTfrontend/util/FileEngine.cpp	Sat Oct 21 00:58:01 2017 +0200
@@ -295,7 +295,11 @@
 
 QString FileEngine::errorString() const
 {
+#if PHYSFS_VER_MAJOR >= 3
+    return PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
+#else
     return PHYSFS_getLastError();
+#endif
 }
 
 bool FileEngine::supportsExtension(Extension extension) const
@@ -352,7 +356,12 @@
 
 QString FileEngineHandler::errorStr()
 {
-    QString s = QString::fromUtf8(PHYSFS_getLastError());
+    QString s;
+#if PHYSFS_VER_MAJOR >= 3
+    s = QString::fromUtf8(PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+#else
+    s = QString::fromUtf8(PHYSFS_getLastError());
+#endif
     return s.isEmpty() ? "ok" : s;
 }