summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt44
-rw-r--r--src/Makefile.am45
-rw-r--r--src/fs/physfs/virtfileprivate.cpp28
-rw-r--r--src/fs/physfs/virtfileprivate.h43
-rw-r--r--src/fs/physfs/virtfs.cpp (renamed from src/fs/virtfs.cpp)56
-rw-r--r--src/fs/physfs/virtfsphys.cpp (renamed from src/fs/virtfsphys.cpp)5
-rw-r--r--src/fs/physfs/virtfsphys.h (renamed from src/fs/virtfsphys.h)0
-rw-r--r--src/fs/physfs/virtfsphys_unittest.cc (renamed from src/fs/virtfsphys_unittest.cc)3
-rw-r--r--src/fs/virtfile.cpp7
-rw-r--r--src/fs/virtfs.h8
-rw-r--r--src/fs/virtfs/virtdirentry.cpp (renamed from src/fs/virtdirentry.cpp)2
-rw-r--r--src/fs/virtfs/virtdirentry.h (renamed from src/fs/virtdirentry.h)0
-rw-r--r--src/fs/virtfs/virtfileprivate.cpp (renamed from src/fs/virtfileprivate.cpp)16
-rw-r--r--src/fs/virtfs/virtfileprivate.h (renamed from src/fs/virtfileprivate.h)10
-rw-r--r--src/fs/virtfs/virtfs.cpp257
-rw-r--r--src/fs/virtfs/virtfsdir.cpp (renamed from src/fs/virtfsdir.cpp)47
-rw-r--r--src/fs/virtfs/virtfsdir.h (renamed from src/fs/virtfsdir.h)9
-rw-r--r--src/fs/virtfs/virtfsdir_unittest.cc (renamed from src/fs/virtfsdir_unittest.cc)4
-rw-r--r--src/fs/virtfs/virtfszip.cpp (renamed from src/fs/virtfszip.cpp)43
-rw-r--r--src/fs/virtfs/virtfszip.h (renamed from src/fs/virtfszip.h)10
-rw-r--r--src/fs/virtfs/virtfszip_unittest.cc (renamed from src/fs/virtfszip_unittest.cc)5
-rw-r--r--src/fs/virtfs/virtzipentry.cpp (renamed from src/fs/virtzipentry.cpp)4
-rw-r--r--src/fs/virtfs/virtzipentry.h (renamed from src/fs/virtzipentry.h)0
-rw-r--r--src/fs/virtfs/zip.cpp (renamed from src/fs/zip.cpp)7
-rw-r--r--src/fs/virtfs/zip.h (renamed from src/fs/zip.h)0
-rw-r--r--src/fs/virtfs/zip_unittest.cc (renamed from src/fs/zip_unittest.cc)7
-rw-r--r--src/fs/virtfs/ziplocalheader.cpp (renamed from src/fs/ziplocalheader.cpp)4
-rw-r--r--src/fs/virtfs/ziplocalheader.h (renamed from src/fs/ziplocalheader.h)0
-rw-r--r--src/fs/virtfstools.cpp8
-rw-r--r--src/integrity_unittest.cc4
-rw-r--r--src/utils/dumplibs.cpp7
-rw-r--r--src/utils/dumplibs_unittest.cc4
32 files changed, 501 insertions, 186 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a7e2c3c28..bf2e2e46d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -887,27 +887,17 @@ SET(SRCS
utils/perfomance.cpp
utils/perfomance.h
utils/debugmemoryobject.h
- fs/virtfsdir.cpp
- fs/virtfsdir.h
fs/virtfsfuncs.h
- fs/virtfsphys.cpp
- fs/virtfsphys.h
+ fs/physfs/virtfsphys.cpp
+ fs/physfs/virtfsphys.h
fs/virtfsrwops.cpp
fs/virtfsrwops.h
fs/virtfstools.cpp
fs/virtfstools.h
- fs/virtfszip.cpp
- fs/virtfszip.h
fs/virtlist.cpp
fs/virtlist.h
- fs/virtzipentry.cpp
- fs/virtzipentry.h
- fs/virtfs.cpp
+ fs/physfs/virtfs.cpp
fs/virtfs.h
- fs/zip.cpp
- fs/zip.h
- fs/ziplocalheader.cpp
- fs/ziplocalheader.h
utils/process.cpp
utils/process.h
utils/sdl2helper.cpp
@@ -923,12 +913,10 @@ SET(SRCS
utils/stringvector.h
utils/timer.cpp
utils/timer.h
- fs/virtdirentry.cpp
- fs/virtdirentry.h
fs/virtfile.cpp
fs/virtfile.h
- fs/virtfileprivate.cpp
- fs/virtfileprivate.h
+ fs/physfs/virtfileprivate.cpp
+ fs/physfs/virtfileprivate.h
utils/mutex.h
utils/naclmessages.cpp
utils/naclmessages.h
@@ -1788,27 +1776,17 @@ SET(DYE_CMD_SRCS
fs/paths.h
utils/perfomance.cpp
utils/perfomance.h
- fs/virtfsdir.cpp
- fs/virtfsdir.h
fs/virtfsfuncs.h
- fs/virtfsphys.cpp
- fs/virtfsphys.h
+ fs/physfs/virtfsphys.cpp
+ fs/physfs/virtfsphys.h
fs/virtfsrwops.cpp
fs/virtfsrwops.h
fs/virtfstools.cpp
fs/virtfstools.h
- fs/virtfszip.cpp
- fs/virtfszip.h
fs/virtlist.cpp
fs/virtlist.h
- fs/virtzipentry.cpp
- fs/virtzipentry.h
- fs/virtfs.cpp
+ fs/physfs/virtfs.cpp
fs/virtfs.h
- fs/zip.cpp
- fs/zip.h
- fs/ziplocalheader.cpp
- fs/ziplocalheader.h
utils/sdl2helper.cpp
utils/sdl2helper.h
utils/sdlcheckutils.cpp
@@ -1820,12 +1798,10 @@ SET(DYE_CMD_SRCS
utils/stringutils.h
utils/timer.cpp
utils/timer.h
- fs/virtdirentry.cpp
- fs/virtdirentry.h
fs/virtfile.cpp
fs/virtfile.h
- fs/virtfileprivate.cpp
- fs/virtfileprivate.h
+ fs/physfs/virtfileprivate.cpp
+ fs/physfs/virtfileprivate.h
utils/xml.cpp
utils/xml.h
utils/xml.inc
diff --git a/src/Makefile.am b/src/Makefile.am
index 31d78afe7..22ef18bee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -563,7 +563,6 @@ BASE_SRC += events/actionevent.h \
fs/virtfstools.h \
fs/virtlist.cpp \
fs/virtlist.h \
- fs/virtfs.cpp \
fs/virtfs.h \
utils/process.cpp \
utils/process.h \
@@ -584,8 +583,6 @@ BASE_SRC += events/actionevent.h \
utils/timer.h \
fs/virtfile.cpp \
fs/virtfile.h \
- fs/virtfileprivate.cpp \
- fs/virtfileprivate.h \
utils/mutex.h \
utils/naclmessages.cpp \
utils/naclmessages.h \
@@ -828,22 +825,28 @@ BASE_SRC += events/actionevent.h \
if USE_PHYSFS
BASE_SRC += \
- fs/virtfsphys.cpp \
- fs/virtfsphys.h
+ fs/physfs/virtfileprivate.cpp \
+ fs/physfs/virtfileprivate.h \
+ fs/physfs/virtfs.cpp \
+ fs/physfs/virtfsphys.cpp \
+ fs/physfs/virtfsphys.h
else
BASE_SRC += \
- fs/virtdirentry.cpp \
- fs/virtdirentry.h \
- fs/virtfsdir.cpp \
- fs/virtfsdir.h \
- fs/virtfszip.cpp \
- fs/virtfszip.h \
- fs/virtzipentry.cpp \
- fs/virtzipentry.h \
- fs/zip.cpp \
- fs/zip.h \
- fs/ziplocalheader.cpp \
- fs/ziplocalheader.h
+ fs/virtfs/virtdirentry.cpp \
+ fs/virtfs/virtdirentry.h \
+ fs/virtfs/virtfileprivate.cpp \
+ fs/virtfs/virtfileprivate.h \
+ fs/virtfs/virtfs.cpp \
+ fs/virtfs/virtfsdir.cpp \
+ fs/virtfs/virtfsdir.h \
+ fs/virtfs/virtfszip.cpp \
+ fs/virtfs/virtfszip.h \
+ fs/virtfs/virtzipentry.cpp \
+ fs/virtfs/virtzipentry.h \
+ fs/virtfs/zip.cpp \
+ fs/virtfs/zip.h \
+ fs/virtfs/ziplocalheader.cpp \
+ fs/virtfs/ziplocalheader.h
endif
if ENABLE_PUGIXML
@@ -1951,12 +1954,12 @@ manaplustests_SOURCES = ${SRC} \
if USE_PHYSFS
manaplustests_SOURCES += \
- fs/virtfsphys_unittest.cc
+ fs/physfs/virtfsphys_unittest.cc
else
manaplustests_SOURCES += \
- fs/virtfsdir_unittest.cc \
- fs/zip_unittest.cc \
- fs/virtfszip_unittest.cc
+ fs/virtfs/virtfsdir_unittest.cc \
+ fs/virtfs/zip_unittest.cc \
+ fs/virtfs/virtfszip_unittest.cc
endif
manaplustests_SOURCES += \
diff --git a/src/fs/physfs/virtfileprivate.cpp b/src/fs/physfs/virtfileprivate.cpp
new file mode 100644
index 000000000..9df6e9578
--- /dev/null
+++ b/src/fs/physfs/virtfileprivate.cpp
@@ -0,0 +1,28 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "fs/physfs/virtfileprivate.h"
+
+#include "debug.h"
+
+VirtFilePrivate::VirtFilePrivate(PHYSFS_file *restrict const file) :
+ mFile(file)
+{
+}
diff --git a/src/fs/physfs/virtfileprivate.h b/src/fs/physfs/virtfileprivate.h
new file mode 100644
index 000000000..75ad6a337
--- /dev/null
+++ b/src/fs/physfs/virtfileprivate.h
@@ -0,0 +1,43 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef UTILS_VIRTFILEPRIVATE_H
+#define UTILS_VIRTFILEPRIVATE_H
+
+#include "localconsts.h"
+
+PRAGMA45(GCC diagnostic push)
+PRAGMA45(GCC diagnostic ignored "-Wlong-long")
+#include <physfs.h>
+PRAGMA45(GCC diagnostic pop)
+
+struct VirtFilePrivate final
+{
+ explicit VirtFilePrivate(PHYSFS_file *restrict const file);
+
+ A_DELETE_COPY(VirtFilePrivate)
+
+ ~VirtFilePrivate();
+
+ // physfs fields
+ PHYSFS_file *mFile;
+};
+
+#endif // UTILS_VIRTFILEPRIVATE_H
diff --git a/src/fs/virtfs.cpp b/src/fs/physfs/virtfs.cpp
index 69f379a08..7a1484081 100644
--- a/src/fs/virtfs.cpp
+++ b/src/fs/physfs/virtfs.cpp
@@ -20,11 +20,7 @@
#include "fs/virtfs.h"
-#ifdef USE_PHYSFS
-#include "fs/virtfsphys.h"
-#else // USE_PHYSFS
-#include "fs/virtfsdir.h"
-#endif // USE_PHYSFS
+#include "fs/physfs/virtfsphys.h"
#include "fs/virtfile.h"
#include "fs/virtfsfuncs.h"
#include "fs/virtlist.h"
@@ -37,76 +33,41 @@ namespace VirtFs
{
void init(const std::string &restrict name)
{
-#ifdef USE_PHYSFS
VirtFsPhys::init(name);
-#else // USE_PHYSFS
- VirtFsDir::init(name);
-#endif // USE_PHYSFS
updateDirSeparator();
}
void updateDirSeparator()
{
-#ifdef USE_PHYSFS
dirSeparator = VirtFsPhys::getDirSeparator();
-#else // USE_PHYSFS
-#ifdef WIN32
- dirSeparator = "\\";
-#else // WIN32
- dirSeparator = "/";
-#endif // WIN32
-#endif // USE_PHYSFS
}
const char *getDirSeparator()
{
-#ifdef USE_PHYSFS
- return VirtFsPhys::getDirSeparator();
-#else // USE_PHYSFS
return dirSeparator;
-#endif // USE_PHYSFS
}
const char *getBaseDir()
{
-#ifdef USE_PHYSFS
return VirtFsPhys::getBaseDir();
-#else // USE_PHYSFS
- return VirtFsDir::getBaseDir();
-#endif // USE_PHYSFS
}
const char *getUserDir()
{
-#ifdef USE_PHYSFS
return VirtFsPhys::getUserDir();
-#else // USE_PHYSFS
- return VirtFsDir::getUserDir();
-#endif // USE_PHYSFS
}
bool exists(const std::string &restrict name)
{
-#ifdef USE_PHYSFS
return VirtFsPhys::exists(name);
-#else // USE_PHYSFS
- return VirtFsDir::exists(name) || VirtFsZip::exists(name);
-#endif // USE_PHYSFS
}
- VirtList *enumerateFiles(const std::string &restrict dirName)
+ VirtList *enumerateFiles(std::string dirName)
{
-#ifdef USE_PHYSFS
- return VirtFsPhys::enumerateFiles(dir);
-#else // USE_PHYSFS
- VirtList *const list = new VirtList;
- VirtFsDir::enumerateFiles(dirName, list);
- VirtFsZip::enumerateFiles(dirName, list);
- return list;
-#endif // USE_PHYSFS
+ return VirtFsPhys::enumerateFiles(dirName);
}
- bool isDirectory(const std::string &restrict name)
+ bool isDirectory(std::string name)
{
return VirtFsPhys::isDirectory(name);
}
@@ -121,7 +82,7 @@ namespace VirtFs
delete handle;
}
- VirtFile *openRead(const std::string &restrict filename)
+ VirtFile *openRead(std::string filename)
{
return VirtFsPhys::openRead(filename);
}
@@ -163,7 +124,7 @@ namespace VirtFs
return VirtFsPhys::removeZipFromSearchPath(oldDir);
}
- std::string getRealDir(const std::string &restrict filename)
+ std::string getRealDir(std::string filename)
{
return VirtFsPhys::getRealDir(filename);
}
@@ -180,12 +141,7 @@ namespace VirtFs
bool deinit()
{
-#ifdef USE_PHYSFS
return VirtFsPhys::deinit();
-#else // USE_PHYSFS
- VirtFsDir::deinit();
- return true;
-#endif // USE_PHYSFS
}
void permitLinks(const bool val)
diff --git a/src/fs/virtfsphys.cpp b/src/fs/physfs/virtfsphys.cpp
index d5cb1c1a2..3cb044277 100644
--- a/src/fs/virtfsphys.cpp
+++ b/src/fs/physfs/virtfsphys.cpp
@@ -18,13 +18,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtfsphys.h"
+#include "fs/physfs/virtfsphys.h"
#include "fs/virtfile.h"
-#include "fs/virtfileprivate.h"
#include "fs/virtfsfuncs.h"
#include "fs/virtlist.h"
+#include "fs/physfs/virtfileprivate.h"
+
#include "utils/checkutils.h"
#include <iostream>
diff --git a/src/fs/virtfsphys.h b/src/fs/physfs/virtfsphys.h
index 743530c6c..743530c6c 100644
--- a/src/fs/virtfsphys.h
+++ b/src/fs/physfs/virtfsphys.h
diff --git a/src/fs/virtfsphys_unittest.cc b/src/fs/physfs/virtfsphys_unittest.cc
index cb7013248..8e81cfe2b 100644
--- a/src/fs/virtfsphys_unittest.cc
+++ b/src/fs/physfs/virtfsphys_unittest.cc
@@ -22,10 +22,11 @@
#include "fs/paths.h"
#include "fs/virtfs.h"
-#include "fs/virtfsphys.h"
#include "fs/virtfstools.h"
#include "fs/virtlist.h"
+#include "fs/physfs/virtfsphys.h"
+
#include "utils/checkutils.h"
#include "utils/delete2.h"
diff --git a/src/fs/virtfile.cpp b/src/fs/virtfile.cpp
index 2fe475d4f..8a06be4e5 100644
--- a/src/fs/virtfile.cpp
+++ b/src/fs/virtfile.cpp
@@ -20,9 +20,14 @@
#include "fs/virtfile.h"
-#include "fs/virtfileprivate.h"
#include "fs/virtfsfuncs.h"
+#ifdef USE_PHYSFS
+#include "fs/physfs/virtfileprivate.h"
+#else // USE_PHYSFS
+#include "fs/virtfs/virtfileprivate.h"
+#endif // USE_PHYSFS
+
#include "debug.h"
VirtFile::VirtFile(const VirtFsFuncs *restrict const funcs0) :
diff --git a/src/fs/virtfs.h b/src/fs/virtfs.h
index e0f188cfb..9a24ad8ba 100644
--- a/src/fs/virtfs.h
+++ b/src/fs/virtfs.h
@@ -38,11 +38,11 @@ namespace VirtFs
const char *getBaseDir();
const char *getUserDir();
bool exists(const std::string &restrict name);
- VirtList *enumerateFiles(const std::string &restrict dir) RETURNS_NONNULL;
- bool isDirectory(const std::string &restrict name);
+ VirtList *enumerateFiles(std::string dir) RETURNS_NONNULL;
+ bool isDirectory(std::string name);
bool isSymbolicLink(const std::string &restrict name);
void freeList(VirtList *restrict const handle);
- VirtFile *openRead(const std::string &restrict filename);
+ VirtFile *openRead(std::string filename);
VirtFile *openWrite(const std::string &restrict filename);
VirtFile *openAppend(const std::string &restrict filename);
bool setWriteDir(const std::string &restrict newDir);
@@ -52,7 +52,7 @@ namespace VirtFs
bool addZipToSearchPath(const std::string &restrict newDir,
const Append append);
bool removeZipFromSearchPath(const std::string &restrict oldDir);
- std::string getRealDir(const std::string &restrict filename);
+ std::string getRealDir(std::string filename);
bool mkdir(const std::string &restrict dirName);
bool remove(const std::string &restrict filename);
bool deinit();
diff --git a/src/fs/virtdirentry.cpp b/src/fs/virtfs/virtdirentry.cpp
index 693aba6a3..73d2dc175 100644
--- a/src/fs/virtdirentry.cpp
+++ b/src/fs/virtfs/virtdirentry.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtdirentry.h"
+#include "fs/virtfs/virtdirentry.h"
#include "debug.h"
diff --git a/src/fs/virtdirentry.h b/src/fs/virtfs/virtdirentry.h
index b3d3faff6..b3d3faff6 100644
--- a/src/fs/virtdirentry.h
+++ b/src/fs/virtfs/virtdirentry.h
diff --git a/src/fs/virtfileprivate.cpp b/src/fs/virtfs/virtfileprivate.cpp
index 4be55fc1b..06e0418bb 100644
--- a/src/fs/virtfileprivate.cpp
+++ b/src/fs/virtfs/virtfileprivate.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtfileprivate.h"
+#include "fs/virtfs/virtfileprivate.h"
#include <unistd.h>
#include <zlib.h>
@@ -26,7 +26,6 @@
#include "debug.h"
VirtFilePrivate::VirtFilePrivate() :
- mFile(nullptr),
mBuf(nullptr),
mPos(0U),
mSize(0U),
@@ -35,7 +34,6 @@ VirtFilePrivate::VirtFilePrivate() :
}
VirtFilePrivate::VirtFilePrivate(const int fd) :
- mFile(nullptr),
mBuf(nullptr),
mPos(0U),
mSize(0U),
@@ -43,18 +41,8 @@ VirtFilePrivate::VirtFilePrivate(const int fd) :
{
}
-VirtFilePrivate::VirtFilePrivate(PHYSFS_file *restrict const file) :
- mFile(file),
- mBuf(nullptr),
- mPos(0U),
- mSize(0U),
- mFd(-1)
-{
-}
-
VirtFilePrivate::VirtFilePrivate(uint8_t *restrict const buf,
const size_t sz) :
- mFile(nullptr),
mBuf(buf),
mPos(0U),
mSize(sz),
@@ -64,8 +52,6 @@ VirtFilePrivate::VirtFilePrivate(uint8_t *restrict const buf,
VirtFilePrivate::~VirtFilePrivate()
{
- if (mFile != nullptr)
- PHYSFS_close(mFile);
if (mFd != -1)
close(mFd);
if (mBuf)
diff --git a/src/fs/virtfileprivate.h b/src/fs/virtfs/virtfileprivate.h
index 758c1b5aa..0af9f66e8 100644
--- a/src/fs/virtfileprivate.h
+++ b/src/fs/virtfs/virtfileprivate.h
@@ -23,17 +23,10 @@
#include "localconsts.h"
-PRAGMA45(GCC diagnostic push)
-PRAGMA45(GCC diagnostic ignored "-Wlong-long")
-#include <physfs.h>
-PRAGMA45(GCC diagnostic pop)
-
struct VirtFilePrivate final
{
VirtFilePrivate();
- explicit VirtFilePrivate(PHYSFS_file *restrict const file);
-
explicit VirtFilePrivate(const int fd);
VirtFilePrivate(uint8_t *restrict const buf,
@@ -43,9 +36,6 @@ struct VirtFilePrivate final
~VirtFilePrivate();
- // physfs fields
- PHYSFS_file *mFile;
-
// zipfs fields
uint8_t *mBuf;
diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp
new file mode 100644
index 000000000..3d223ccba
--- /dev/null
+++ b/src/fs/virtfs/virtfs.cpp
@@ -0,0 +1,257 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2013-2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "fs/virtfs.h"
+
+#include "fs/paths.h"
+#include "fs/virtfile.h"
+#include "fs/virtfsfuncs.h"
+#include "fs/virtlist.h"
+
+#include "fs/virtfs/virtdirentry.h"
+#include "fs/virtfs/virtfsdir.h"
+#include "fs/virtfs/virtfszip.h"
+
+#include "utils/checkutils.h"
+
+#include "debug.h"
+
+const char *dirSeparator = nullptr;
+
+namespace VirtFs
+{
+ void init(const std::string &restrict name)
+ {
+ VirtFsDir::init(name);
+ updateDirSeparator();
+ }
+
+ void updateDirSeparator()
+ {
+#ifdef WIN32
+ dirSeparator = "\\";
+#else // WIN32
+ dirSeparator = "/";
+#endif // WIN32
+ }
+
+ const char *getDirSeparator()
+ {
+ return dirSeparator;
+ }
+
+ const char *getBaseDir()
+ {
+ return VirtFsDir::getBaseDir();
+ }
+
+ const char *getUserDir()
+ {
+ return VirtFsDir::getUserDir();
+ }
+
+ bool exists(const std::string &restrict name)
+ {
+ return VirtFsDir::exists(name) || VirtFsZip::exists(name);
+ }
+
+ VirtList *enumerateFiles(std::string dirName)
+ {
+ VirtList *const list = new VirtList;
+ prepareFsPath(dirName);
+ if (checkPath(dirName) == false)
+ {
+ reportAlways("VirtFs::enumerateFiles invalid path: %s",
+ dirName.c_str());
+ return list;
+ }
+
+ VirtFsDir::enumerateFiles(dirName, list);
+ VirtFsZip::enumerateFiles(dirName, list);
+ return list;
+ }
+
+ bool isDirectory(std::string name)
+ {
+ prepareFsPath(name);
+ if (checkPath(name) == false)
+ {
+ reportAlways("VirtFs::isDirectory invalid path: %s",
+ name.c_str());
+ return false;
+ }
+ return VirtFsDir::isDirectoryInternal(name) ||
+ VirtFsZip::isDirectoryInternal(name);
+ }
+
+ bool isSymbolicLink(const std::string &restrict name)
+ {
+ return VirtFsDir::isSymbolicLink(name);
+ }
+
+ void freeList(VirtList *restrict const handle)
+ {
+ delete handle;
+ }
+
+ VirtFile *openRead(std::string filename)
+ {
+ prepareFsPath(filename);
+ if (checkPath(filename) == false)
+ {
+ reportAlways("VirtFs::openRead invalid path: %s",
+ filename.c_str());
+ return nullptr;
+ }
+ VirtDirEntry *const entry = VirtFsDir::searchEntryByPath(filename);
+ if (entry == nullptr)
+ return VirtFsZip::openReadInternal(filename);
+ return VirtFsDir::openReadDirEntry(entry, filename);
+ }
+
+ VirtFile *openWrite(const std::string &restrict filename)
+ {
+ return VirtFsDir::openWrite(filename);
+ }
+
+ VirtFile *openAppend(const std::string &restrict filename)
+ {
+ return VirtFsDir::openAppend(filename);
+ }
+
+ bool setWriteDir(const std::string &restrict newDir)
+ {
+ return VirtFsDir::setWriteDir(newDir);
+ }
+
+ bool addDirToSearchPath(const std::string &restrict newDir,
+ const Append append)
+ {
+ return VirtFsDir::addToSearchPath(newDir, append);
+ }
+
+ bool removeDirFromSearchPath(const std::string &restrict oldDir)
+ {
+ return VirtFsDir::removeFromSearchPath(oldDir);
+ }
+
+ bool addZipToSearchPath(const std::string &restrict newDir,
+ const Append append)
+ {
+ return VirtFsZip::addToSearchPath(newDir, append);
+ }
+
+ bool removeZipFromSearchPath(const std::string &restrict oldDir)
+ {
+ return VirtFsZip::removeFromSearchPath(oldDir);
+ }
+
+ std::string getRealDir(std::string filename)
+ {
+ prepareFsPath(filename);
+ if (checkPath(filename) == false)
+ {
+ reportAlways("VirtFs::getRealDir invalid path: %s",
+ filename.c_str());
+ return std::string();
+ }
+ VirtDirEntry *const entry = VirtFsDir::searchEntryByPath(filename);
+ if (entry == nullptr)
+ return VirtFsZip::getRealDirInternal(filename);
+ return entry->mUserDir;
+ }
+
+ bool mkdir(const std::string &restrict dirname)
+ {
+ return VirtFsDir::mkdir(dirname);
+ }
+
+ bool remove(const std::string &restrict filename)
+ {
+ return VirtFsDir::remove(filename);
+ }
+
+ bool deinit()
+ {
+ VirtFsDir::deinit();
+ return true;
+ }
+
+ void permitLinks(const bool val)
+ {
+ VirtFsDir::permitLinks(val);
+ }
+
+ const char *getLastError()
+ {
+ return "";
+ }
+
+ int close(VirtFile *restrict const file)
+ {
+ if (file == nullptr)
+ return 0;
+ return file->funcs->close(file);
+ }
+
+ int64_t read(VirtFile *restrict const file,
+ void *restrict const buffer,
+ const uint32_t objSize,
+ const uint32_t objCount)
+ {
+ return file->funcs->read(file,
+ buffer,
+ objSize,
+ objCount);
+ }
+
+ int64_t write(VirtFile *restrict const file,
+ const void *restrict const buffer,
+ const uint32_t objSize,
+ const uint32_t objCount)
+ {
+ return file->funcs->write(file,
+ buffer,
+ objSize,
+ objCount);
+ }
+
+ int64_t fileLength(VirtFile *restrict const file)
+ {
+ return file->funcs->fileLength(file);
+ }
+
+ int64_t tell(VirtFile *restrict const file)
+ {
+ return file->funcs->tell(file);
+ }
+
+ int seek(VirtFile *restrict const file,
+ const uint64_t pos)
+ {
+ return file->funcs->seek(file,
+ pos);
+ }
+
+ int eof(VirtFile *restrict const file)
+ {
+ return file->funcs->eof(file);
+ }
+} // namespace VirtFs
diff --git a/src/fs/virtfsdir.cpp b/src/fs/virtfs/virtfsdir.cpp
index cb512f2ca..13c2f9ba4 100644
--- a/src/fs/virtfsdir.cpp
+++ b/src/fs/virtfs/virtfsdir.cpp
@@ -18,18 +18,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtfsdir.h"
+#include "fs/virtfs/virtfsdir.h"
#include "fs/files.h"
#include "fs/mkdir.h"
#include "fs/paths.h"
-#include "fs/virtdirentry.h"
#include "fs/virtfs.h"
#include "fs/virtfile.h"
-#include "fs/virtfileprivate.h"
#include "fs/virtfsfuncs.h"
#include "fs/virtlist.h"
+#include "fs/virtfs/virtdirentry.h"
+#include "fs/virtfs/virtfileprivate.h"
+
#include "utils/checkutils.h"
#include "utils/dtor.h"
#include "utils/stringutils.h"
@@ -63,13 +64,13 @@ namespace VirtFsDir
static VirtFile *openFile(std::string filename,
const int mode)
{
+ prepareFsPath(filename);
if (checkPath(filename) == false)
{
reportAlways("VirtFsDir::openFile invalid path: %s",
filename.c_str());
return nullptr;
}
- prepareFsPath(filename);
VirtDirEntry *const entry = searchEntryByPath(filename);
if (entry == nullptr)
return nullptr;
@@ -91,6 +92,25 @@ namespace VirtFsDir
}
} // namespace
+ VirtFile *openReadDirEntry(VirtDirEntry *const entry,
+ const std::string &filename)
+ {
+ const std::string path = entry->mRootDir + filename;
+ const int fd = open(path.c_str(),
+ O_RDONLY,
+ S_IRUSR | S_IWUSR);
+ if (fd == -1)
+ {
+ reportAlways("VirtFsDir::openReadDirEntry file open error: %s",
+ filename.c_str());
+ return nullptr;
+ }
+ VirtFile *restrict const file = new VirtFile(&funcs);
+ file->mPrivate = new VirtFilePrivate(fd);
+
+ return file;
+ }
+
VirtDirEntry *searchEntryByRoot(const std::string &restrict root)
{
FOR_EACH (std::vector<VirtDirEntry*>::const_iterator, it, mEntries)
@@ -338,15 +358,9 @@ namespace VirtFsDir
return false;
}
- VirtList *enumerateFiles(const std::string &dirName)
+ VirtList *enumerateFiles(std::string dirName)
{
VirtList *const list = new VirtList;
- return enumerateFiles(dirName, list);
- }
-
- VirtList *enumerateFiles(std::string dirName,
- VirtList *const list)
- {
prepareFsPath(dirName);
if (checkPath(dirName) == false)
{
@@ -354,6 +368,12 @@ namespace VirtFsDir
dirName.c_str());
return list;
}
+ return enumerateFiles(dirName, list);
+ }
+
+ VirtList *enumerateFiles(const std::string &restrict dirName,
+ VirtList *restrict const list)
+ {
StringVect &names = list->names;
FOR_EACH (std::vector<VirtDirEntry*>::iterator, it, mEntries)
{
@@ -407,6 +427,11 @@ namespace VirtFsDir
dirName.c_str());
return false;
}
+ return isDirectoryInternal(dirName);
+ }
+
+ bool isDirectoryInternal(const std::string &restrict dirName)
+ {
FOR_EACH (std::vector<VirtDirEntry*>::iterator, it, mEntries)
{
VirtDirEntry *const entry = *it;
diff --git a/src/fs/virtfsdir.h b/src/fs/virtfs/virtfsdir.h
index 0ec2f466d..75df7fb18 100644
--- a/src/fs/virtfsdir.h
+++ b/src/fs/virtfs/virtfsdir.h
@@ -38,6 +38,8 @@ namespace VirtFsDir
{
VirtDirEntry *searchEntryByRoot(const std::string &restrict root);
VirtDirEntry *searchEntryByPath(const std::string &restrict path);
+ VirtFile *openReadDirEntry(VirtDirEntry *const entry,
+ const std::string &filename);
const char *getBaseDir();
const char *getUserDir();
bool addToSearchPath(std::string newDir,
@@ -52,10 +54,11 @@ namespace VirtFsDir
void deinit();
std::vector<VirtDirEntry*> &getEntries();
bool exists(std::string name);
- VirtList *enumerateFiles(const std::string &dirName) RETURNS_NONNULL;
- VirtList *enumerateFiles(std::string dirName,
- VirtList *const list) RETURNS_NONNULL;
+ VirtList *enumerateFiles(std::string dirName) RETURNS_NONNULL;
+ VirtList *enumerateFiles(const std::string &restrict dirName,
+ VirtList *restrict const list) RETURNS_NONNULL;
bool isDirectory(std::string dirName);
+ bool isDirectoryInternal(const std::string &restrict dirName);
bool isSymbolicLink(std::string name);
void freeList(VirtList *restrict const handle);
VirtFile *openRead(const std::string &restrict filename);
diff --git a/src/fs/virtfsdir_unittest.cc b/src/fs/virtfs/virtfsdir_unittest.cc
index 589b10e4c..ad55acf2e 100644
--- a/src/fs/virtfsdir_unittest.cc
+++ b/src/fs/virtfs/virtfsdir_unittest.cc
@@ -20,8 +20,8 @@
#include "catch.hpp"
-#include "fs/virtdirentry.h"
-#include "fs/virtfsdir.h"
+#include "fs/virtfs/virtdirentry.h"
+#include "fs/virtfs/virtfsdir.h"
#include "fs/virtfstools.h"
#include "fs/virtlist.h"
diff --git a/src/fs/virtfszip.cpp b/src/fs/virtfs/virtfszip.cpp
index 538eb7513..c4ce6f9e8 100644
--- a/src/fs/virtfszip.cpp
+++ b/src/fs/virtfs/virtfszip.cpp
@@ -18,17 +18,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtfszip.h"
+#include "fs/virtfs/virtfszip.h"
#include "fs/files.h"
#include "fs/paths.h"
-#include "fs/virtfile.h"
-#include "fs/virtfileprivate.h"
#include "fs/virtfsfuncs.h"
+#include "fs/virtfile.h"
#include "fs/virtlist.h"
-#include "fs/virtzipentry.h"
-#include "fs/zip.h"
-#include "fs/ziplocalheader.h"
+
+#include "fs/virtfs/virtfileprivate.h"
+#include "fs/virtfs/virtzipentry.h"
+#include "fs/virtfs/zip.h"
+#include "fs/virtfs/ziplocalheader.h"
#include "utils/checkutils.h"
#include "utils/dtor.h"
@@ -240,6 +241,11 @@ namespace VirtFsZip
filename.c_str());
return std::string();
}
+ return getRealDirInternal(filename);
+ }
+
+ std::string getRealDirInternal(const std::string &filename)
+ {
ZipLocalHeader *restrict const header = searchHeaderByName(filename);
if (header != nullptr)
return header->zipEntry->mArchiveName;
@@ -261,23 +267,22 @@ namespace VirtFsZip
return false;
}
- VirtList *enumerateFiles(const std::string &dirName)
+ VirtList *enumerateFiles(std::string dirName)
{
VirtList *const list = new VirtList;
- return enumerateFiles(dirName, list);
- }
-
- VirtList *enumerateFiles(std::string dirName,
- VirtList *const list)
- {
prepareFsPath(dirName);
- VirtList *const list = new VirtList;
if (checkPath(dirName) == false)
{
reportAlways("VirtFsZip::enumerateFiles invalid path: %s",
dirName.c_str());
return list;
}
+ return enumerateFiles(dirName, list);
+ }
+
+ VirtList *enumerateFiles(std::string dirName,
+ VirtList *restrict const list)
+ {
if (findLast(dirName, std::string(dirSeparator)) == false)
dirName += dirSeparator;
StringVect &names = list->names;
@@ -355,6 +360,11 @@ namespace VirtFsZip
dirName.c_str());
return false;
}
+ return isDirectoryInternal(dirName);
+ }
+
+ bool isDirectoryInternal(std::string dirName)
+ {
if (findLast(dirName, std::string(dirSeparator)) == false)
dirName += dirSeparator;
FOR_EACH (std::vector<VirtZipEntry*>::const_iterator, it, mEntries)
@@ -398,6 +408,11 @@ namespace VirtFsZip
filename.c_str());
return nullptr;
}
+ return openReadInternal(filename);
+ }
+
+ VirtFile *openReadInternal(const std::string &filename)
+ {
ZipLocalHeader *restrict const header = searchHeaderByName(filename);
if (header != nullptr)
{
diff --git a/src/fs/virtfszip.h b/src/fs/virtfs/virtfszip.h
index fd7a0568b..c1ed7b05c 100644
--- a/src/fs/virtfszip.h
+++ b/src/fs/virtfs/virtfszip.h
@@ -37,7 +37,8 @@ struct ZipLocalHeader;
namespace VirtFsZip
{
- VirtZipEntry *searchEntryByArchive(const std::string &restrict archiveName);
+ VirtZipEntry *searchEntryByArchive(const std::string &restrict
+ archiveName);
ZipLocalHeader *searchHeaderByName(const std::string &restrict filename);
bool addToSearchPath(std::string newDir,
const Append append);
@@ -50,17 +51,20 @@ namespace VirtFsZip
void deinit();
std::vector<VirtZipEntry*> &getEntries();
bool exists(std::string name);
- VirtList *enumerateFiles(const std::string &dirName) RETURNS_NONNULL;
+ VirtList *enumerateFiles(std::string dirName) RETURNS_NONNULL;
VirtList *enumerateFiles(std::string dirName,
- VirtList *const list) RETURNS_NONNULL;
+ VirtList *restrict const list) RETURNS_NONNULL;
bool isDirectory(std::string dirName);
+ bool isDirectoryInternal(std::string dirName);
bool isSymbolicLink(std::string name);
void freeList(VirtList *restrict const handle);
VirtFile *openRead(std::string filename);
+ VirtFile *openReadInternal(const std::string &filename);
VirtFile *openWrite(const std::string &restrict filename);
VirtFile *openAppend(const std::string &restrict filename);
bool setWriteDir(const std::string &restrict newDir);
std::string getRealDir(std::string filename);
+ std::string getRealDirInternal(const std::string &filename);
bool mkdir(const std::string &restrict dirName);
bool remove(const std::string &restrict filename);
void permitLinks(const bool val);
diff --git a/src/fs/virtfszip_unittest.cc b/src/fs/virtfs/virtfszip_unittest.cc
index 4840a23a9..7ac442c78 100644
--- a/src/fs/virtfszip_unittest.cc
+++ b/src/fs/virtfs/virtfszip_unittest.cc
@@ -22,8 +22,9 @@
#include "fs/files.h"
#include "fs/virtlist.h"
-#include "fs/virtfszip.h"
-#include "fs/virtzipentry.h"
+
+#include "fs/virtfs/virtfszip.h"
+#include "fs/virtfs/virtzipentry.h"
#include "utils/checkutils.h"
#include "utils/delete2.h"
diff --git a/src/fs/virtzipentry.cpp b/src/fs/virtfs/virtzipentry.cpp
index e0189fccf..bed925d2f 100644
--- a/src/fs/virtzipentry.cpp
+++ b/src/fs/virtfs/virtzipentry.cpp
@@ -18,9 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtzipentry.h"
+#include "fs/virtfs/virtzipentry.h"
-#include "fs/ziplocalheader.h"
+#include "fs/virtfs/ziplocalheader.h"
#include "utils/dtor.h"
diff --git a/src/fs/virtzipentry.h b/src/fs/virtfs/virtzipentry.h
index fac36cc2d..fac36cc2d 100644
--- a/src/fs/virtzipentry.h
+++ b/src/fs/virtfs/virtzipentry.h
diff --git a/src/fs/zip.cpp b/src/fs/virtfs/zip.cpp
index 1bdc22639..f27dd05d0 100644
--- a/src/fs/zip.cpp
+++ b/src/fs/virtfs/zip.cpp
@@ -18,11 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/zip.h"
+#include "fs/virtfs/zip.h"
#include "fs/paths.h"
-#include "fs/virtzipentry.h"
-#include "fs/ziplocalheader.h"
+
+#include "fs/virtfs/virtzipentry.h"
+#include "fs/virtfs/ziplocalheader.h"
#include "utils/checkutils.h"
#include "utils/stringutils.h"
diff --git a/src/fs/zip.h b/src/fs/virtfs/zip.h
index 412dbcef9..412dbcef9 100644
--- a/src/fs/zip.h
+++ b/src/fs/virtfs/zip.h
diff --git a/src/fs/zip_unittest.cc b/src/fs/virtfs/zip_unittest.cc
index 44cfb4757..7ac74f66b 100644
--- a/src/fs/zip_unittest.cc
+++ b/src/fs/virtfs/zip_unittest.cc
@@ -23,9 +23,10 @@
#include "logger.h"
#include "fs/files.h"
-#include "fs/virtzipentry.h"
-#include "fs/zip.h"
-#include "fs/ziplocalheader.h"
+
+#include "fs/virtfs/virtzipentry.h"
+#include "fs/virtfs/zip.h"
+#include "fs/virtfs/ziplocalheader.h"
#include "utils/delete2.h"
diff --git a/src/fs/ziplocalheader.cpp b/src/fs/virtfs/ziplocalheader.cpp
index 8af552b0d..1fed2afd8 100644
--- a/src/fs/ziplocalheader.cpp
+++ b/src/fs/virtfs/ziplocalheader.cpp
@@ -18,9 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/ziplocalheader.h"
+#include "fs/virtfs/ziplocalheader.h"
-#include "fs/virtzipentry.h"
+#include "fs/virtfs/virtzipentry.h"
#include "localconsts.h"
diff --git a/src/fs/ziplocalheader.h b/src/fs/virtfs/ziplocalheader.h
index f3a1894ce..f3a1894ce 100644
--- a/src/fs/ziplocalheader.h
+++ b/src/fs/virtfs/ziplocalheader.h
diff --git a/src/fs/virtfstools.cpp b/src/fs/virtfstools.cpp
index 39f1ed413..cf3da4b7a 100644
--- a/src/fs/virtfstools.cpp
+++ b/src/fs/virtfstools.cpp
@@ -24,8 +24,12 @@
#include "fs/paths.h"
#include "fs/virtfs.h"
-#include "fs/virtfsdir.h"
-#include "fs/virtfsphys.h"
+
+#ifdef USE_PHYSFS
+#include "fs/physfs/virtfsphys.h"
+#else // USE_PHYSFS
+#include "fs/virtfs/virtfsdir.h"
+#endif // USE_PHYSFS
#include "fs/virtlist.h"
#include "utils/stringutils.h"
diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc
index b7b97321a..58e22772a 100644
--- a/src/integrity_unittest.cc
+++ b/src/integrity_unittest.cc
@@ -45,7 +45,9 @@
#include "utils/env.h"
#include "utils/delete2.h"
+#ifdef USE_PHYSFS
#include <physfs.h>
+#endif // USE_PHYSFS
#include <SDL_image.h>
#include "debug.h"
@@ -260,6 +262,7 @@ TEST_CASE("integrity tests", "integrity")
REQUIRE(compareBuffers(buf) == true);
}
+#ifdef USE_PHYSFS
SECTION("integrity Loader::getImage test 5")
{
VirtFs::addZipToSearchPath("data/test/test.zip", Append_false);
@@ -402,6 +405,7 @@ TEST_CASE("integrity tests", "integrity")
VirtFs::removeZipFromSearchPath("../data/test/test.zip");
REQUIRE(compareBuffers(buf) == true);
}
+#endif // USE_PHYSFS
SECTION("integrity Loader::getImage test 7")
{
diff --git a/src/utils/dumplibs.cpp b/src/utils/dumplibs.cpp
index 34b63e71a..9a7f42c0c 100644
--- a/src/utils/dumplibs.cpp
+++ b/src/utils/dumplibs.cpp
@@ -118,6 +118,7 @@ void dumpLibs()
logger->log(" libcurl: %s", LIBCURL_VERSION);
logger->log(" libpng: %s", PNG_LIBPNG_VER_STRING);
+#ifdef USE_PHYSFS
PHYSFS_Version physfsVersion;
PHYSFS_VERSION(&physfsVersion);
const std::string physfsCompiled = strprintf("%d.%d.%d",
@@ -125,6 +126,8 @@ void dumpLibs()
physfsVersion.minor,
physfsVersion.patch);
logger->log(" libphysfs: %s", physfsCompiled.c_str());
+#endif // USE_PHYSFS
+
dumpCompiledSdlVersion("SDL", SDL);
dumpCompiledSdlVersion("SDL_net", SDL_NET);
dumpCompiledSdlVersion("SDL_image", SDL_IMAGE);
@@ -135,12 +138,14 @@ void dumpLibs()
#if ZLIB_VERNUM >= 0x1020
logger->log(" zLib: %s", zlibVersion());
#endif // ZLIB_VERNUM >= 0x1020
+#ifdef USE_PHYSFS
PHYSFS_getLinkedVersion(&physfsVersion);
const std::string physfsLinked = strprintf("%d.%d.%d",
physfsVersion.major,
physfsVersion.minor,
physfsVersion.patch);
logger->log(" libphysfs: %s", physfsLinked.c_str());
+#endif // USE_PHYSFS
#ifdef LIBXML_TEST_VERSION
LIBXML_TEST_VERSION
#endif // LIBXML_TEST_VERSION
@@ -160,7 +165,9 @@ void dumpLibs()
dumpLinkedSdlVersion("SDL_ttf", TTF_Linked_Version());
compareVersions("zLib", ZLIB_VERSION, zlibVersion());
+#ifdef USE_PHYSFS
compareVersions("libphysfs", physfsCompiled.c_str(), physfsLinked.c_str());
+#endif // USE_PHYSFS
#ifdef USE_SDL2
compareSDLVersions("SDL", sdlVersionJoin(SDL), &sdlVersion);
#else // USE_SDL2
diff --git a/src/utils/dumplibs_unittest.cc b/src/utils/dumplibs_unittest.cc
index aca0f91f3..20f89f7b7 100644
--- a/src/utils/dumplibs_unittest.cc
+++ b/src/utils/dumplibs_unittest.cc
@@ -31,7 +31,9 @@ PRAGMACLANG6(GCC diagnostic ignored "-Wold-style-cast")
#include <SDL_net.h>
PRAGMACLANG6(GCC diagnostic pop)
#include <SDL_ttf.h>
+#ifdef USE_PHYSFS
#include <physfs.h>
+#endif // USE_PHYSFS
#include <zlib.h>
#include "debug.h"
@@ -47,6 +49,7 @@ TEST_CASE("dumplibs tests")
REQUIRE(build == link);
}
+#ifdef USE_PHYSFS
SECTION("physfs")
{
PHYSFS_Version buildVersion;
@@ -65,6 +68,7 @@ TEST_CASE("dumplibs tests")
REQUIRE(build == link);
}
+#endif // USE_PHYSFS
SECTION("sdl")
{