summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-28 04:10:23 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-28 04:10:23 +0300
commit6ff6d6928328ff2110f028a374ade49415d5a0ba (patch)
tree4337ddc2e83368a2d606b97df08dc206e002ac67 /src/fs
parent475aea387f846561d5029807f804ff789d59e69f (diff)
downloadplus-6ff6d6928328ff2110f028a374ade49415d5a0ba.tar.gz
plus-6ff6d6928328ff2110f028a374ade49415d5a0ba.tar.bz2
plus-6ff6d6928328ff2110f028a374ade49415d5a0ba.tar.xz
plus-6ff6d6928328ff2110f028a374ade49415d5a0ba.zip
Remove physfs support.
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/physfs/virtfileprivate.cpp36
-rw-r--r--src/fs/physfs/virtfileprivate.h45
-rw-r--r--src/fs/physfs/virtfs.cpp221
-rw-r--r--src/fs/physfs/virtfsphys.cpp354
-rw-r--r--src/fs/physfs/virtfsphys.h83
-rw-r--r--src/fs/physfs/virtfsphys_unittest.cc505
-rw-r--r--src/fs/virtfile.cpp4
-rw-r--r--src/fs/virtfs/fileapi.h2
-rw-r--r--src/fs/virtfs/virtdirentry.cpp2
-rw-r--r--src/fs/virtfs/virtdirentry.h2
-rw-r--r--src/fs/virtfs/virtfileprivate.cpp2
-rw-r--r--src/fs/virtfs/virtfileprivate.h2
-rw-r--r--src/fs/virtfs/virtfs.cpp3
-rw-r--r--src/fs/virtfs/virtfs_unittest.cc4
-rw-r--r--src/fs/virtfs/virtfsdir.cpp3
-rw-r--r--src/fs/virtfs/virtfsdir.h2
-rw-r--r--src/fs/virtfs/virtfsentry.cpp4
-rw-r--r--src/fs/virtfs/virtfsentry.h2
-rw-r--r--src/fs/virtfs/virtfszip.cpp3
-rw-r--r--src/fs/virtfs/virtfszip.h2
-rw-r--r--src/fs/virtfs/virtzipentry.cpp3
-rw-r--r--src/fs/virtfs/virtzipentry.h2
-rw-r--r--src/fs/virtfs/zip.cpp3
-rw-r--r--src/fs/virtfs/zip.h2
-rw-r--r--src/fs/virtfs/zip_unittest.cc3
-rw-r--r--src/fs/virtfs/ziplocalheader.cpp3
-rw-r--r--src/fs/virtfs/ziplocalheader.h2
-rw-r--r--src/fs/virtfsfuncs.h6
-rw-r--r--src/fs/virtfsrwops.cpp2
-rw-r--r--src/fs/virtfsrwops.h6
30 files changed, 4 insertions, 1309 deletions
diff --git a/src/fs/physfs/virtfileprivate.cpp b/src/fs/physfs/virtfileprivate.cpp
deleted file mode 100644
index 6e6cd7dd6..000000000
--- a/src/fs/physfs/virtfileprivate.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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/>.
- */
-
-#ifdef USE_PHYSFS
-#include "fs/physfs/virtfileprivate.h"
-
-#include "debug.h"
-
-VirtFilePrivate::VirtFilePrivate(PHYSFS_file *restrict const file) :
- mFile(file)
-{
-}
-
-VirtFilePrivate::~VirtFilePrivate()
-{
- if (mFile != nullptr)
- PHYSFS_close(mFile);
-}
-#endif // USE_PHYSFS
diff --git a/src/fs/physfs/virtfileprivate.h b/src/fs/physfs/virtfileprivate.h
deleted file mode 100644
index 1067cfda0..000000000
--- a/src/fs/physfs/virtfileprivate.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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
-#ifdef USE_PHYSFS
-
-#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 // USE_PHYSFS
-#endif // UTILS_VIRTFILEPRIVATE_H
diff --git a/src/fs/physfs/virtfs.cpp b/src/fs/physfs/virtfs.cpp
deleted file mode 100644
index c9fd34ba4..000000000
--- a/src/fs/physfs/virtfs.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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/>.
- */
-
-#ifdef USE_PHYSFS
-
-#include "fs/virtfs.h"
-
-#include "fs/physfs/virtfsphys.h"
-#include "fs/virtfile.h"
-#include "fs/virtfsfuncs.h"
-#include "fs/virtlist.h"
-
-#include "debug.h"
-
-const char *dirSeparator = nullptr;
-
-namespace VirtFs
-{
- void init(const std::string &restrict name)
- {
- VirtFsPhys::init(name);
- updateDirSeparator();
- }
-
- void updateDirSeparator()
- {
- dirSeparator = VirtFsPhys::getDirSeparator();
- }
-
- const char *getDirSeparator()
- {
- return dirSeparator;
- }
-
- const char *getBaseDir()
- {
- return VirtFsPhys::getBaseDir();
- }
-
- const char *getUserDir()
- {
- return VirtFsPhys::getUserDir();
- }
-
- bool exists(std::string name)
- {
- return VirtFsPhys::exists(name);
- }
-
- VirtList *enumerateFiles(std::string dirName)
- {
- return VirtFsPhys::enumerateFiles(dirName);
- }
-
- bool isDirectory(std::string name)
- {
- return VirtFsPhys::isDirectory(name);
- }
-
- bool isSymbolicLink(const std::string &restrict name)
- {
- return VirtFsPhys::isSymbolicLink(name);
- }
-
- void freeList(VirtList *restrict const handle)
- {
- delete handle;
- }
-
- VirtFile *openRead(std::string filename)
- {
- return VirtFsPhys::openRead(filename);
- }
-
- VirtFile *openWrite(std::string filename)
- {
- return VirtFsPhys::openWrite(filename);
- }
-
- VirtFile *openAppend(std::string filename)
- {
- return VirtFsPhys::openAppend(filename);
- }
-
- bool setWriteDir(const std::string &restrict newDir)
- {
- return VirtFsPhys::setWriteDir(newDir);
- }
-
- bool mountDir(std::string newDir,
- const Append append)
- {
- return VirtFsPhys::mountDir(newDir, append);
- }
-
- bool mountDirSilent(std::string newDir,
- const Append append)
- {
- return VirtFsPhys::mountDir(newDir, append);
- }
-
- bool unmountDir(std::string oldDir)
- {
- return VirtFsPhys::unmountDir(oldDir);
- }
-
- bool unmountDirSilent(std::string oldDir)
- {
- return VirtFsPhys::unmountDir(oldDir);
- }
-
- bool mountZip(std::string newDir,
- const Append append)
- {
- return VirtFsPhys::mountZip(newDir, append);
- }
-
- bool unmountZip(std::string oldDir)
- {
- return VirtFsPhys::unmountZip(oldDir);
- }
-
- std::string getRealDir(std::string filename)
- {
- return VirtFsPhys::getRealDir(filename);
- }
-
- bool mkdir(const std::string &restrict dirname)
- {
- return VirtFsPhys::mkdir(dirname);
- }
-
- bool remove(const std::string &restrict filename)
- {
- return VirtFsPhys::remove(filename);
- }
-
- bool deinit()
- {
- return VirtFsPhys::deinit();
- }
-
- void permitLinks(const bool val)
- {
- VirtFsPhys::permitLinks(val);
- }
-
- const char *getLastError()
- {
- return VirtFsPhys::getLastError();
- }
-
- 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
-#endif // USE_PHYSFS
diff --git a/src/fs/physfs/virtfsphys.cpp b/src/fs/physfs/virtfsphys.cpp
deleted file mode 100644
index f6d0abf47..000000000
--- a/src/fs/physfs/virtfsphys.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * 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/>.
- */
-
-#ifdef USE_PHYSFS
-
-#include "fs/physfs/virtfsphys.h"
-
-#include "fs/virtfile.h"
-#include "fs/virtfsfuncs.h"
-#include "fs/virtlist.h"
-
-#include "fs/physfs/virtfileprivate.h"
-
-#include "utils/checkutils.h"
-
-#include <iostream>
-#include <unistd.h>
-
-#ifdef ANDROID
-#include "fs/paths.h"
-#endif // ANDROID
-
-#include "debug.h"
-
-namespace
-{
- const char *dirSeparator = nullptr;
- VirtFsFuncs funcs;
-} // namespace
-
-namespace VirtFsPhys
-{
-#if defined(__native_client__)
- void init(const std::string &restrict name A_UNUSED)
- {
- if (!PHYSFS_init("/fakebinary"))
-#elif defined(ANDROID)
- void init(const std::string &restrict name A_UNUSED)
- {
- if (!PHYSFS_init((getRealPath(".").append("/fakebinary")).c_str()))
-#else // defined(__native_client__)
-
- void init(const std::string &restrict name)
- {
- if (!PHYSFS_init(name.c_str()))
-#endif // defined(__native_client__)
- {
- std::cout << "Error while initializing PhysFS: "
- << VirtFsPhys::getLastError() << std::endl;
- _exit(1);
- }
- updateDirSeparator();
- atexit(reinterpret_cast<void(*)()>(PHYSFS_deinit));
- initFuncs(&funcs);
- }
-
- void initFuncs()
- {
- initFuncs(&funcs);
- }
-
- void initFuncs(VirtFsFuncs *restrict const ptr)
- {
- ptr->close = &VirtFsPhys::close;
- ptr->read = &VirtFsPhys::read;
- ptr->write = &VirtFsPhys::write;
- ptr->fileLength = &VirtFsPhys::fileLength;
- ptr->tell = &VirtFsPhys::tell;
- ptr->seek = &VirtFsPhys::seek;
- ptr->eof = &VirtFsPhys::eof;
- }
-
- void updateDirSeparator()
- {
- dirSeparator = PHYSFS_getDirSeparator();
- }
-
- const char *getDirSeparator()
- {
- return dirSeparator;
- }
-
- const char *getBaseDir()
- {
- return PHYSFS_getBaseDir();
- }
-
- const char *getUserDir()
- {
- return PHYSFS_getUserDir();
- }
-
- bool exists(const std::string &restrict name)
- {
- return PHYSFS_exists(name.c_str());
- }
-
- VirtList *enumerateFiles(const std::string &restrict dir)
- {
- char ** handle = PHYSFS_enumerateFiles(dir.c_str());
- VirtList *const files = new VirtList;
- if (handle == nullptr)
- return files;
- for (const char *const *i = handle; *i; i++)
- {
- std::string str = *i;
- files->names.push_back(str);
- }
- PHYSFS_freeList(handle);
- return files;
- }
-
- bool isDirectory(const std::string &restrict name)
- {
- return PHYSFS_isDirectory(name.c_str());
- }
-
- bool isSymbolicLink(const std::string &restrict name)
- {
- return PHYSFS_isSymbolicLink(name.c_str());
- }
-
- void freeList(VirtList *restrict const handle)
- {
- delete handle;
- }
-
- VirtFile *openRead(const std::string &restrict filename)
- {
- PHYSFS_file *restrict const handle = PHYSFS_openRead(
- filename.c_str());
- if (!handle)
- return nullptr;
- VirtFile *restrict const file = new VirtFile(&funcs);
- file->mPrivate = new VirtFilePrivate(handle);
- return file;
- }
-
- VirtFile *openWrite(const std::string &restrict filename)
- {
- PHYSFS_file *restrict const handle = PHYSFS_openWrite(
- filename.c_str());
- if (!handle)
- return nullptr;
- VirtFile *restrict const file = new VirtFile(&funcs);
- file->mPrivate = new VirtFilePrivate(handle);
- return file;
- }
-
- VirtFile *openAppend(const std::string &restrict filename)
- {
- PHYSFS_file *restrict const handle = PHYSFS_openAppend(
- filename.c_str());
- if (!handle)
- return nullptr;
- VirtFile *restrict const file = new VirtFile(&funcs);
- file->mPrivate = new VirtFilePrivate(handle);
- return file;
- }
-
- bool setWriteDir(const std::string &restrict newDir)
- {
- return PHYSFS_setWriteDir(newDir.c_str());
- }
-
- bool mountDir(const std::string &restrict newDir,
- const Append append)
- {
- logger->log("Add virtual directory: " + newDir);
- if (newDir.find(".zip") != std::string::npos)
- {
- reportAlways("Called mountDir with zip archive");
- return false;
- }
- const int ret = PHYSFS_addToSearchPath(newDir.c_str(),
- append == Append_true ? 1 : 0);
- if (ret == 0)
- {
- logger->log("mountDir error: %s",
- VirtFsPhys::getLastError());
- }
- return ret;
- }
-
- bool unmountDir(const std::string &restrict oldDir)
- {
- logger->log("Remove virtual directory: " + oldDir);
- if (oldDir.find(".zip") != std::string::npos)
- {
- reportAlways("Called unmountDir with zip archive");
- return false;
- }
- const int ret = PHYSFS_removeFromSearchPath(oldDir.c_str());
- if (ret == 0)
- {
- logger->log("unmountDir error: %s",
- VirtFsPhys::getLastError());
- }
- return ret;
- }
-
- bool mountZip(const std::string &restrict newDir,
- const Append append)
- {
- logger->log("Add virtual zip: " + newDir);
- if (newDir.find(".zip") == std::string::npos)
- {
- reportAlways("Called mountZip without zip archive");
- return false;
- }
- const int ret = PHYSFS_addToSearchPath(newDir.c_str(),
- append == Append_true ? 1 : 0);
- if (ret == 0)
- {
- logger->log("mountZip error: %s",
- VirtFsPhys::getLastError());
- }
- return ret;
- }
-
- bool unmountZip(const std::string &restrict oldDir)
- {
- logger->log("Remove virtual zip: " + oldDir);
- if (oldDir.find(".zip") == std::string::npos)
- {
- reportAlways("Called unmountZip without zip archive");
- return false;
- }
- const int ret = PHYSFS_removeFromSearchPath(oldDir.c_str());
- if (ret == 0)
- {
- logger->log("unmountZip error: %s",
- VirtFsPhys::getLastError());
- }
- return ret;
- }
-
- std::string getRealDir(const std::string &restrict filename)
- {
- const char *const str = PHYSFS_getRealDir(filename.c_str());
- if (str == nullptr)
- return std::string();
- return str;
- }
-
- bool mkdir(const std::string &restrict dirname)
- {
- return PHYSFS_mkdir(dirname.c_str());
- }
-
- bool remove(const std::string &restrict filename)
- {
- return PHYSFS_delete(filename.c_str());
- }
-
- bool deinit()
- {
- if (PHYSFS_deinit() != 0)
- {
- logger->log("Physfs deinit error: %s",
- VirtFsPhys::getLastError());
- return false;
- }
- return true;
- }
-
- void permitLinks(const bool val)
- {
- PHYSFS_permitSymbolicLinks(val ? 1 : 0);
- }
-
- const char *getLastError()
- {
- return PHYSFS_getLastError();
- }
-
- int close(VirtFile *restrict const file)
- {
- if (file == nullptr)
- return 0;
- delete file;
- return 1;
- }
-
- int64_t read(VirtFile *restrict const file,
- void *restrict const buffer,
- const uint32_t objSize,
- const uint32_t objCount)
- {
- if (file == nullptr)
- return 0;
- return PHYSFS_read(file->mPrivate->mFile,
- buffer,
- objSize,
- objCount);
- }
-
- int64_t write(VirtFile *restrict const file,
- const void *restrict const buffer,
- const uint32_t objSize,
- const uint32_t objCount)
- {
- if (file == nullptr)
- return 0;
- return PHYSFS_write(file->mPrivate->mFile,
- buffer,
- objSize,
- objCount);
- }
-
- int64_t fileLength(VirtFile *restrict const file)
- {
- if (file == nullptr)
- return -1;
- return PHYSFS_fileLength(file->mPrivate->mFile);
- }
-
- int64_t tell(VirtFile *restrict const file)
- {
- if (file == nullptr)
- return -1;
- return PHYSFS_tell(file->mPrivate->mFile);
- }
-
- int seek(VirtFile *restrict const file,
- const uint64_t pos)
- {
- return PHYSFS_seek(file->mPrivate->mFile,
- pos);
- }
-
- int eof(VirtFile *restrict const file)
- {
- return PHYSFS_eof(file->mPrivate->mFile);
- }
-} // namespace VirtFsPhys
-#endif // USE_PHYSFS
diff --git a/src/fs/physfs/virtfsphys.h b/src/fs/physfs/virtfsphys.h
deleted file mode 100644
index 1daebfb4f..000000000
--- a/src/fs/physfs/virtfsphys.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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/>.
- */
-
-#ifndef UTILS_VIRTFSPHYS_H
-#define UTILS_VIRTFSPHYS_H
-
-#ifdef USE_PHYSFS
-
-#include "enums/simpletypes/append.h"
-
-#include "localconsts.h"
-
-#include <string>
-
-struct VirtFile;
-struct VirtFsFuncs;
-struct VirtList;
-
-namespace VirtFsPhys
-{
- void init(const std::string &restrict name);
- void initFuncs(VirtFsFuncs *restrict const ptr);
- void initFuncs();
- void updateDirSeparator();
- const char *getDirSeparator();
- 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);
- bool isSymbolicLink(const std::string &restrict name);
- void freeList(VirtList *restrict const handle);
- VirtFile *openRead(const std::string &restrict filename);
- VirtFile *openWrite(const std::string &restrict filename);
- VirtFile *openAppend(const std::string &restrict filename);
- bool setWriteDir(const std::string &restrict newDir);
- bool mountDir(const std::string &restrict newDir,
- const Append append);
- bool unmountDir(const std::string &restrict oldDir);
- bool mountZip(const std::string &restrict newDir,
- const Append append);
- bool unmountZip(const std::string &restrict oldDir);
- std::string getRealDir(const std::string &restrict filename);
- bool mkdir(const std::string &restrict dirName);
- bool remove(const std::string &restrict filename);
- bool deinit();
- void permitLinks(const bool val);
- const char *getLastError();
- int64_t read(VirtFile *restrict const handle,
- void *restrict const buffer,
- const uint32_t objSize,
- const uint32_t objCount);
- int64_t write(VirtFile *restrict const file,
- const void *restrict const buffer,
- const uint32_t objSize,
- const uint32_t objCount);
- int close(VirtFile *restrict const file);
- int64_t fileLength(VirtFile *restrict const file);
- int64_t tell(VirtFile *restrict const file);
- int seek(VirtFile *restrict const file,
- const uint64_t pos);
- int eof(VirtFile *restrict const file);
-} // namespace VirtFsPhys
-
-#endif // USE_PHYSFS
-#endif // UTILS_VIRTFSPHYS_H
diff --git a/src/fs/physfs/virtfsphys_unittest.cc b/src/fs/physfs/virtfsphys_unittest.cc
deleted file mode 100644
index 636d67a91..000000000
--- a/src/fs/physfs/virtfsphys_unittest.cc
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2016-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/>.
- */
-
-#ifdef USE_PHYSFS
-#include "catch.hpp"
-
-#include "fs/paths.h"
-#include "fs/virtfs.h"
-#include "fs/virtlist.h"
-
-#include "fs/physfs/virtfsphys.h"
-
-#include "utils/checkutils.h"
-#include "utils/delete2.h"
-
-#include "debug.h"
-
-TEST_CASE("VirtFsPhys dirSeparator")
-{
- VirtFsPhys::initFuncs();
- REQUIRE(VirtFs::getDirSeparator() != nullptr);
- REQUIRE(VirtFsPhys::getDirSeparator() ==
- std::string(VirtFs::getDirSeparator()));
- VirtFsPhys::updateDirSeparator();
- REQUIRE(VirtFs::getDirSeparator() != nullptr);
- REQUIRE(VirtFsPhys::getDirSeparator() ==
- std::string(VirtFs::getDirSeparator()));
-}
-
-TEST_CASE("VirtFsPhys getBaseDir")
-{
- VirtFsPhys::initFuncs();
- REQUIRE(VirtFsPhys::getBaseDir() != nullptr);
-}
-
-TEST_CASE("VirtFsPhys getUserDir")
-{
- VirtFsPhys::initFuncs();
- REQUIRE(VirtFsPhys::getUserDir() != nullptr);
- REQUIRE(VirtFsPhys::getUserDir() == getHomePath());
-}
-
-TEST_CASE("VirtFsPhys exists")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger();
- VirtFsPhys::mountDir("data", Append_false);
- VirtFsPhys::mountDir("../data", Append_false);
-
- REQUIRE(VirtFsPhys::exists("test/units.xml") == true);
- REQUIRE(VirtFsPhys::exists("test/units123.xml") == false);
- REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false);
- REQUIRE(VirtFsPhys::exists("units.xml") == false);
-
- VirtFsPhys::mountDir("data/test", Append_false);
- VirtFsPhys::mountDir("../data/test", Append_false);
-
- REQUIRE(VirtFsPhys::exists("test/units.xml") == true);
- REQUIRE(VirtFsPhys::exists("test/units123.xml") == false);
- REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false);
- REQUIRE(VirtFsPhys::exists("units.xml") == true);
-
- VirtFsPhys::unmountDir("data/test");
- VirtFsPhys::unmountDir("../data/test");
-
- REQUIRE(VirtFsPhys::exists("test/units.xml") == true);
- REQUIRE(VirtFsPhys::exists("test/units123.xml") == false);
- REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false);
- REQUIRE(VirtFsPhys::exists("units.xml") == false);
-
- VirtFsPhys::unmountDir("data");
- VirtFsPhys::unmountDir("../data");
- delete2(logger);
-}
-
-TEST_CASE("VirtFsPhys exists2")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger();
- VirtFsPhys::mountZip("data/test/test2.zip", Append_false);
- VirtFsPhys::mountZip("../data/test/test2.zip", Append_false);
-
- REQUIRE(VirtFsPhys::exists("test/units.xml") == false);
- REQUIRE(VirtFsPhys::exists("test.txt") == true);
- REQUIRE(VirtFsPhys::exists("units123.xml") == false);
- REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false);
- REQUIRE(VirtFsPhys::exists("units.xml") == true);
-
- VirtFsPhys::unmountZip("data/test/test2.zip");
- VirtFsPhys::unmountZip("../data/test/test2.zip");
- delete2(logger);
-}
-
-static void removeTemp(StringVect &restrict list)
-{
- int cnt = 0;
- std::sort(list.begin(), list.end());
-
- FOR_EACH (StringVectIter, it, list)
- {
- if (*it != "serverlistplus.xml.part")
- {
- logger->log("file: %d %s",
- cnt,
- (*it).c_str());
- cnt ++;
- }
- }
-
- FOR_EACH (StringVectIter, it, list)
- {
- if (*it == "serverlistplus.xml.part")
- {
- list.erase(it);
- return;
- }
- }
-}
-
-TEST_CASE("VirtFsPhys enumerateFiles1")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger;
-
- VirtFsPhys::mountDir("data", Append_false);
- VirtFsPhys::mountDir("../data", Append_false);
-
- VirtList *list = nullptr;
-
- const int cnt1 = VirtFsPhys::exists("test/test2.txt") ? 28 : 27;
- const int cnt2 = 28;
-
- VirtFsPhys::permitLinks(false);
- list = VirtFsPhys::enumerateFiles("test");
- removeTemp(list->names);
- const size_t sz = list->names.size();
- REQUIRE(sz == cnt1);
- VirtFsPhys::freeList(list);
-
- VirtFsPhys::permitLinks(true);
- list = VirtFsPhys::enumerateFiles("test");
- removeTemp(list->names);
- REQUIRE(list->names.size() == cnt2);
- VirtFsPhys::freeList(list);
-
- VirtFsPhys::permitLinks(false);
- list = VirtFsPhys::enumerateFiles("test");
- removeTemp(list->names);
- REQUIRE(list->names.size() == cnt1);
- VirtFsPhys::freeList(list);
-
- VirtFsPhys::unmountDir("data");
- VirtFsPhys::unmountDir("../data");
- delete2(logger);
-}
-
-TEST_CASE("VirtFsPhys enumerateFiles2")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger;
-
- VirtFsPhys::mountDir("data/test/dir1",
- Append_false);
- VirtFsPhys::mountDir("../data/test/dir1",
- Append_false);
-
- VirtList *list = nullptr;
-
- list = VirtFsPhys::enumerateFiles("/");
- REQUIRE(list->names.size() == 5);
- VirtFsPhys::freeList(list);
-
- VirtFsPhys::unmountDir("data/test/dir1");
- VirtFsPhys::unmountDir("../data/test/dir1");
- delete2(logger);
-}
-
-static bool inList(VirtList *list,
- const std::string &name)
-{
- FOR_EACH (StringVectCIter, it, list->names)
- {
- if (*it == name)
- return true;
- }
- return false;
-}
-
-TEST_CASE("VirtFsPhys enumerateFiles3")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger;
-
- VirtFsPhys::mountZip("data/test/test.zip",
- Append_false);
- VirtFsPhys::mountZip("../data/test/test.zip",
- Append_false);
-
- VirtList *list = nullptr;
-
- list = VirtFsPhys::enumerateFiles("/");
- REQUIRE(inList(list, "units.xml") == false);
- REQUIRE(inList(list, "test.txt") == false);
- VirtFsPhys::freeList(list);
-
- VirtFsPhys::unmountZip("data/test/test.zip");
- VirtFsPhys::unmountZip("../data/test/test.zip");
- delete2(logger);
-}
-
-TEST_CASE("VirtFsPhys enumerateFiles4")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger;
-
- VirtFsPhys::mountZip("data/test/test2.zip",
- Append_false);
- VirtFsPhys::mountZip("../data/test/test2.zip",
- Append_false);
-
- VirtList *list = nullptr;
-
- list = VirtFsPhys::enumerateFiles("/");
- REQUIRE(inList(list, "units.xml") == true);
- REQUIRE(inList(list, "test.txt") == true);
- VirtFsPhys::freeList(list);
-
- VirtFsPhys::unmountZip("data/test/test2.zip");
- VirtFsPhys::unmountZip("../data/test/test2.zip");
- delete2(logger);
-}
-
-TEST_CASE("VirtFsPhys isDirectory")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger();
- VirtFsPhys::mountDir("data", Append_false);
- VirtFsPhys::mountDir("../data", Append_false);
-
- REQUIRE(VirtFsPhys::isDirectory("test/units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test/units.xml/") == false);
- REQUIRE(VirtFsPhys::isDirectory("test//units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test/units123.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test//units123.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("tesQ/units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("tesQ//units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test") == true);
- REQUIRE(VirtFsPhys::isDirectory("test/") == true);
- REQUIRE(VirtFsPhys::isDirectory("test//") == true);
- REQUIRE(VirtFsPhys::isDirectory("test/dir1") == true);
- REQUIRE(VirtFsPhys::isDirectory("test//dir1") == true);
- REQUIRE(VirtFsPhys::isDirectory("test//dir1/") == true);
- REQUIRE(VirtFsPhys::isDirectory("test//dir1//") == true);
- REQUIRE(VirtFsPhys::isDirectory("test/dir1/") == true);
- REQUIRE(VirtFsPhys::isDirectory("test/dir1//") == true);
- REQUIRE(VirtFsPhys::isDirectory("testQ") == false);
- REQUIRE(VirtFsPhys::isDirectory("testQ/") == false);
- REQUIRE(VirtFsPhys::isDirectory("testQ//") == false);
-
- VirtFsPhys::mountDir("data/test", Append_false);
- VirtFsPhys::mountDir("../data/test", Append_false);
-
- REQUIRE(VirtFsPhys::isDirectory("test/units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test/units.xml/") == false);
- REQUIRE(VirtFsPhys::isDirectory("test//units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test/units123.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("tesQ/units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test") == true);
- REQUIRE(VirtFsPhys::isDirectory("testQ") == false);
- REQUIRE(VirtFsPhys::isDirectory("test/dir1") == true);
-
- VirtFsPhys::unmountDir("data/test");
- VirtFsPhys::unmountDir("../data/test");
-
- REQUIRE(VirtFsPhys::isDirectory("test/units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("test/units123.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("tesQ/units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("units.xml") == false);
- REQUIRE(VirtFsPhys::isDirectory("units.xml/") == false);
- REQUIRE(VirtFsPhys::isDirectory("test") == true);
- REQUIRE(VirtFsPhys::isDirectory("test/") == true);
- REQUIRE(VirtFsPhys::isDirectory("testQ") == false);
- REQUIRE(VirtFsPhys::isDirectory("test/dir1") == true);
-
- VirtFsPhys::unmountDir("data");
- VirtFsPhys::unmountDir("../data");
- delete2(logger);
-}
-
-TEST_CASE("VirtFsPhys openRead")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger();
- VirtFsPhys::mountDir("data", Append_false);
- VirtFsPhys::mountDir("../data", Append_false);
-
- VirtFile *file = nullptr;
-
- file = VirtFsPhys::openRead("test/units.xml");
- REQUIRE(file != nullptr);
- VirtFsPhys::close(file);
- file = VirtFsPhys::openRead("test/units123.xml");
- REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("tesQ/units.xml");
- REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("units.xml");
- REQUIRE(file == nullptr);
-// file = VirtFsPhys::openRead("test");
-// REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("testQ");
- REQUIRE(file == nullptr);
-
- VirtFsPhys::mountDir("data/test", Append_false);
- VirtFsPhys::mountDir("../data/test", Append_false);
-
- file = VirtFsPhys::openRead("test/units.xml");
- REQUIRE(file != nullptr);
- VirtFsPhys::close(file);
- file = VirtFsPhys::openRead("test/units123.xml");
- REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("tesQ/units.xml");
- REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("units.xml");
- REQUIRE(file != nullptr);
- VirtFsPhys::close(file);
-// file = VirtFsPhys::openRead("test");
-// REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("testQ");
- REQUIRE(file == nullptr);
-
- VirtFsPhys::unmountDir("data/test");
- VirtFsPhys::unmountDir("../data/test");
-
- file = VirtFsPhys::openRead("test/units.xml");
- REQUIRE(file != nullptr);
- VirtFsPhys::close(file);
- file = VirtFsPhys::openRead("test/units123.xml");
- REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("tesQ/units.xml");
- REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("units.xml");
- REQUIRE(file == nullptr);
-// file = VirtFsPhys::openRead("test");
-// REQUIRE(file == nullptr);
- file = VirtFsPhys::openRead("testQ");
- REQUIRE(file == nullptr);
-
- VirtFsPhys::unmountDir("data");
- VirtFsPhys::unmountDir("../data");
- delete2(logger);
-}
-
-TEST_CASE("VirtFsPhys mountZip")
-{
- // +++ need implement
-}
-
-TEST_CASE("VirtFsPhys unmountZip")
-{
- // +++ need implement
-}
-
-TEST_CASE("VirtFsPhys getRealDir")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger();
- REQUIRE(VirtFsPhys::getRealDir(".") == "");
- REQUIRE(VirtFsPhys::getRealDir("..") == "");
- const bool dir1 = VirtFsPhys::mountDir("data", Append_false);
- REQUIRE((dir1 || VirtFsPhys::mountDir(
- "../data", Append_false)) == true);
- if (dir1 == true)
- {
- REQUIRE(VirtFsPhys::getRealDir("test") == "data");
- REQUIRE(VirtFsPhys::getRealDir("test/test.txt") ==
- "data");
- }
- else
- {
- REQUIRE(VirtFsPhys::getRealDir("test") == "../data");
- REQUIRE(VirtFsPhys::getRealDir("test/test.txt") ==
- "../data");
- }
- REQUIRE(VirtFsPhys::getRealDir("zzz") == "");
-
- VirtFsPhys::mountDir("data/test", Append_false);
- VirtFsPhys::mountDir("../data/test", Append_false);
- if (dir1 == true)
- {
- REQUIRE(VirtFsPhys::getRealDir("test") == "data");
- REQUIRE(VirtFsPhys::getRealDir("test/test.txt") ==
- "data");
- REQUIRE(VirtFsPhys::getRealDir("test.txt") ==
- "data/test");
- }
- else
- {
- REQUIRE(VirtFsPhys::getRealDir("test") == "../data");
- REQUIRE(VirtFsPhys::getRealDir("test/test.txt") ==
- "../data");
- REQUIRE(VirtFsPhys::getRealDir("test.txt") ==
- "../data/test");
- }
- REQUIRE(VirtFsPhys::getRealDir("zzz") == "");
-
- if (dir1 == true)
- {
- VirtFsPhys::mountZip("data/test/test.zip", Append_false);
- REQUIRE(VirtFsPhys::getRealDir("dir/brimmedhat.png") ==
- "data/test/test.zip");
- REQUIRE(VirtFsPhys::getRealDir("hide.png") == "data/test");
- }
- else
- {
- VirtFsPhys::mountZip("../data/test/test.zip", Append_false);
- REQUIRE(VirtFsPhys::getRealDir("dir/brimmedhat.png") ==
- "../data/test/test.zip");
- REQUIRE(VirtFsPhys::getRealDir("hide.png") == "../data/test");
- }
-
- VirtFsPhys::unmountDir("data/test");
- VirtFsPhys::unmountDir("../data/test");
-
- if (dir1 == true)
- {
- REQUIRE(VirtFsPhys::getRealDir("test") == "data");
- REQUIRE(VirtFsPhys::getRealDir("test/test.txt") ==
- "data");
- REQUIRE(VirtFsPhys::getRealDir("dir/hide.png") ==
- "data/test/test.zip");
- }
- else
- {
- REQUIRE(VirtFsPhys::getRealDir("test") == "../data");
- REQUIRE(VirtFsPhys::getRealDir("test/test.txt") ==
- "../data");
- REQUIRE(VirtFsPhys::getRealDir("dir/hide.png") ==
- "../data/test/test.zip");
- }
- REQUIRE(VirtFsPhys::exists("dir/hide.png"));
- REQUIRE(VirtFsPhys::getRealDir("zzz") == "");
-
- VirtFsPhys::unmountDir("data");
- VirtFsPhys::unmountDir("../data");
- VirtFsPhys::unmountZip("data/test/test.zip");
- VirtFsPhys::unmountZip("../data/test/test.zip");
- delete2(logger);
-}
-
-TEST_CASE("VirtFsPhys read")
-{
- VirtFsPhys::initFuncs();
- logger = new Logger();
- VirtFsPhys::mountDir("data", Append_false);
- VirtFsPhys::mountDir("../data", Append_false);
-
- VirtFile *file = VirtFsPhys::openRead("test/test.txt");
- REQUIRE(file != nullptr);
- REQUIRE(VirtFsPhys::fileLength(file) == 23);
- const int fileSize = VirtFsPhys::fileLength(file);
-
- void *restrict buffer = calloc(fileSize + 1, 1);
- REQUIRE(VirtFsPhys::read(file, buffer, 1, fileSize) == fileSize);
- REQUIRE(strcmp(static_cast<char*>(buffer),
- "test line 1\ntest line 2") == 0);
- REQUIRE(VirtFsPhys::tell(file) == fileSize);
- REQUIRE(VirtFsPhys::eof(file) == true);
-
- free(buffer);
- buffer = calloc(fileSize + 1, 1);
- REQUIRE(VirtFsPhys::seek(file, 12) != 0);
- REQUIRE(VirtFsPhys::eof(file) == false);
- REQUIRE(VirtFsPhys::tell(file) == 12);
- REQUIRE(VirtFsPhys::read(file, buffer, 1, 11) == 11);
- REQUIRE(strcmp(static_cast<char*>(buffer),
- "test line 2") == 0);
- REQUIRE(VirtFsPhys::eof(file) == true);
-
- VirtFsPhys::close(file);
- free(buffer);
-
- VirtFsPhys::unmountDir("data");
- VirtFsPhys::unmountDir("../data");
- delete2(logger);
-}
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfile.cpp b/src/fs/virtfile.cpp
index 766c193d5..ff7be9627 100644
--- a/src/fs/virtfile.cpp
+++ b/src/fs/virtfile.cpp
@@ -20,11 +20,7 @@
#include "fs/virtfile.h"
-#ifdef USE_PHYSFS
-#include "fs/physfs/virtfileprivate.h"
-#else // USE_PHYSFS
#include "fs/virtfs/virtfileprivate.h"
-#endif // USE_PHYSFS
#include "debug.h"
diff --git a/src/fs/virtfs/fileapi.h b/src/fs/virtfs/fileapi.h
index 121506816..14e7b8204 100644
--- a/src/fs/virtfs/fileapi.h
+++ b/src/fs/virtfs/fileapi.h
@@ -20,7 +20,6 @@
#ifndef UTILS_VIRTFS_FILEAPI_H
#define UTILS_VIRTFS_FILEAPI_H
-#ifndef USE_PHYSFS
#include "localconsts.h"
@@ -46,5 +45,4 @@
#define FILEOPEN_FLAG_APPEND O_WRONLY | O_CREAT | O_APPEND
#endif // USE_FILE_FOPEN
-#endif // USE_PHYSFS
#endif // UTILS_VIRTFS_FILEAPI_H
diff --git a/src/fs/virtfs/virtdirentry.cpp b/src/fs/virtfs/virtdirentry.cpp
index 3cf8dd600..a24fb12f5 100644
--- a/src/fs/virtfs/virtdirentry.cpp
+++ b/src/fs/virtfs/virtdirentry.cpp
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
#include "fs/virtfs/virtdirentry.h"
#include "debug.h"
@@ -35,4 +34,3 @@ VirtDirEntry::VirtDirEntry(const std::string &userDir0,
VirtDirEntry::~VirtDirEntry()
{
}
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtdirentry.h b/src/fs/virtfs/virtdirentry.h
index a1cc4a24f..282eb21cd 100644
--- a/src/fs/virtfs/virtdirentry.h
+++ b/src/fs/virtfs/virtdirentry.h
@@ -20,7 +20,6 @@
#ifndef UTILS_VIRTDIRENTRY_H
#define UTILS_VIRTDIRENTRY_H
-#ifndef USE_PHYSFS
#include "fs/virtfs/virtfsentry.h"
@@ -39,5 +38,4 @@ struct VirtDirEntry final : public VirtFsEntry
std::string userDir;
};
-#endif // USE_PHYSFS
#endif // UTILS_VIRTDIRENTRY_H
diff --git a/src/fs/virtfs/virtfileprivate.cpp b/src/fs/virtfs/virtfileprivate.cpp
index eac55571e..57f06e986 100644
--- a/src/fs/virtfs/virtfileprivate.cpp
+++ b/src/fs/virtfs/virtfileprivate.cpp
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
#include "fs/virtfs/virtfileprivate.h"
#include "debug.h"
@@ -54,4 +53,3 @@ VirtFilePrivate::~VirtFilePrivate()
FILECLOSE(mFd);
delete [] mBuf;
}
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtfileprivate.h b/src/fs/virtfs/virtfileprivate.h
index a9e1edf3e..d96cb5781 100644
--- a/src/fs/virtfs/virtfileprivate.h
+++ b/src/fs/virtfs/virtfileprivate.h
@@ -20,7 +20,6 @@
#ifndef UTILS_VIRTFILEPRIVATE_H
#define UTILS_VIRTFILEPRIVATE_H
-#ifndef USE_PHYSFS
#include "localconsts.h"
@@ -50,5 +49,4 @@ struct VirtFilePrivate final
FILEHTYPE mFd;
};
-#endif // USE_PHYSFS
#endif // UTILS_VIRTFILEPRIVATE_H
diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp
index dd305303a..fbcb5b2ef 100644
--- a/src/fs/virtfs/virtfs.cpp
+++ b/src/fs/virtfs/virtfs.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "fs/virtfs.h"
#include "fs/files.h"
@@ -570,4 +568,3 @@ namespace VirtFs
return file->funcs->eof(file);
}
} // namespace VirtFs
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc
index 126c3e1a7..1d5087e05 100644
--- a/src/fs/virtfs/virtfs_unittest.cc
+++ b/src/fs/virtfs/virtfs_unittest.cc
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "catch.hpp"
#include "fs/files.h"
@@ -1422,5 +1420,3 @@ TEST_CASE("VirtFs1 read2")
VirtFs::deinit();
delete2(logger);
}
-
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtfsdir.cpp b/src/fs/virtfs/virtfsdir.cpp
index 2092fcf31..357702de6 100644
--- a/src/fs/virtfs/virtfsdir.cpp
+++ b/src/fs/virtfs/virtfsdir.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "fs/virtfs/virtfsdir.h"
#include "fs/files.h"
@@ -447,4 +445,3 @@ namespace VirtFsDir
return pos < 0 || len < 0 || pos >= len;
}
} // namespace VirtFs
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtfsdir.h b/src/fs/virtfs/virtfsdir.h
index b292bd71d..f85100e84 100644
--- a/src/fs/virtfs/virtfsdir.h
+++ b/src/fs/virtfs/virtfsdir.h
@@ -20,7 +20,6 @@
#ifndef UTILS_VIRTFSDIR_H
#define UTILS_VIRTFSDIR_H
-#ifndef USE_PHYSFS
#include "fs/virtfs/fileapi.h"
@@ -85,5 +84,4 @@ namespace VirtFsDir
int eof(VirtFile *restrict const file);
} // namespace VirtFsDir
-#endif // USE_PHYSFS
#endif // UTILS_VIRTFSDIR_H
diff --git a/src/fs/virtfs/virtfsentry.cpp b/src/fs/virtfs/virtfsentry.cpp
index efffd0927..09f68148a 100644
--- a/src/fs/virtfs/virtfsentry.cpp
+++ b/src/fs/virtfs/virtfsentry.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "fs/virtfs/virtfsentry.h"
#include "debug.h"
@@ -35,5 +33,3 @@ VirtFsEntry::VirtFsEntry(const FsEntryTypeT &type0,
VirtFsEntry::~VirtFsEntry()
{
}
-
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtfsentry.h b/src/fs/virtfs/virtfsentry.h
index 56a1e71ee..467d374cb 100644
--- a/src/fs/virtfs/virtfsentry.h
+++ b/src/fs/virtfs/virtfsentry.h
@@ -20,7 +20,6 @@
#ifndef UTILS_VIRTFSENTRY_H
#define UTILS_VIRTFSENTRY_H
-#ifndef USE_PHYSFS
#include "enums/fs/fsentrytype.h"
@@ -46,5 +45,4 @@ struct VirtFsEntry notfinal
VirtFsFuncs *funcs;
};
-#endif // USE_PHYSFS
#endif // UTILS_VIRTFSENTRY_H
diff --git a/src/fs/virtfs/virtfszip.cpp b/src/fs/virtfs/virtfszip.cpp
index e085ac307..e9414136f 100644
--- a/src/fs/virtfs/virtfszip.cpp
+++ b/src/fs/virtfs/virtfszip.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "fs/virtfs/virtfszip.h"
#include "fs/virtfsfuncs.h"
@@ -340,4 +338,3 @@ namespace VirtFsZip
return file->mPrivate->mPos >= file->mPrivate->mSize;
}
} // namespace VirtFsZip
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtfszip.h b/src/fs/virtfs/virtfszip.h
index f615e38fd..9094f9eba 100644
--- a/src/fs/virtfs/virtfszip.h
+++ b/src/fs/virtfs/virtfszip.h
@@ -20,7 +20,6 @@
#ifndef UTILS_VIRTFSZIP_H
#define UTILS_VIRTFSZIP_H
-#ifndef USE_PHYSFS
#include "utils/stringvector.h"
@@ -74,5 +73,4 @@ namespace VirtFsZip
int eof(VirtFile *restrict const file);
} // namespace VirtFsZip
-#endif // USE_PHYSFS
#endif // UTILS_VIRTFSZIP_H
diff --git a/src/fs/virtfs/virtzipentry.cpp b/src/fs/virtfs/virtzipentry.cpp
index 216603bed..c832578bd 100644
--- a/src/fs/virtfs/virtzipentry.cpp
+++ b/src/fs/virtfs/virtzipentry.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "fs/virtfs/virtzipentry.h"
#include "fs/virtfs/ziplocalheader.h"
@@ -41,4 +39,3 @@ VirtZipEntry::~VirtZipEntry()
{
delete_all(mHeaders);
}
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/virtzipentry.h b/src/fs/virtfs/virtzipentry.h
index 6487deeb0..d3c69aa36 100644
--- a/src/fs/virtfs/virtzipentry.h
+++ b/src/fs/virtfs/virtzipentry.h
@@ -20,7 +20,6 @@
#ifndef UTILS_VIRTZIPENTRY_H
#define UTILS_VIRTZIPENTRY_H
-#ifndef USE_PHYSFS
#include "fs/virtfs/virtfsentry.h"
@@ -43,5 +42,4 @@ struct VirtZipEntry final : public VirtFsEntry
std::vector<std::string> mDirs;
};
-#endif // USE_PHYSFS
#endif // UTILS_VIRTZIPENTRY_H
diff --git a/src/fs/virtfs/zip.cpp b/src/fs/virtfs/zip.cpp
index c9276449b..330850aee 100644
--- a/src/fs/virtfs/zip.cpp
+++ b/src/fs/virtfs/zip.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "fs/virtfs/zip.h"
#include "fs/paths.h"
@@ -321,4 +319,3 @@ namespace Zip
return out;
}
} // namespace Zip
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/zip.h b/src/fs/virtfs/zip.h
index 8efbd05e4..89e04408f 100644
--- a/src/fs/virtfs/zip.h
+++ b/src/fs/virtfs/zip.h
@@ -20,7 +20,6 @@
#ifndef UTILS_ZIP_H
#define UTILS_ZIP_H
-#ifndef USE_PHYSFS
#include "localconsts.h"
@@ -39,5 +38,4 @@ namespace Zip
uint8_t *readFile(const ZipLocalHeader *restrict const header);
} // namespace Zip
-#endif // USE_PHYSFS
#endif // UTILS_ZIP_H
diff --git a/src/fs/virtfs/zip_unittest.cc b/src/fs/virtfs/zip_unittest.cc
index 27d4bc1f9..401768b7c 100644
--- a/src/fs/virtfs/zip_unittest.cc
+++ b/src/fs/virtfs/zip_unittest.cc
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "catch.hpp"
#include "logger.h"
@@ -296,4 +294,3 @@ TEST_CASE("Zip readFile")
delete2(logger);
}
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/ziplocalheader.cpp b/src/fs/virtfs/ziplocalheader.cpp
index 40ddcaffd..47ed4d290 100644
--- a/src/fs/virtfs/ziplocalheader.cpp
+++ b/src/fs/virtfs/ziplocalheader.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef USE_PHYSFS
-
#include "fs/virtfs/ziplocalheader.h"
#include "localconsts.h"
@@ -35,4 +33,3 @@ ZipLocalHeader::ZipLocalHeader() :
compressed(false)
{
}
-#endif // USE_PHYSFS
diff --git a/src/fs/virtfs/ziplocalheader.h b/src/fs/virtfs/ziplocalheader.h
index 2ec781858..f3a1894ce 100644
--- a/src/fs/virtfs/ziplocalheader.h
+++ b/src/fs/virtfs/ziplocalheader.h
@@ -20,7 +20,6 @@
#ifndef UTILS_ZIPLOCALHEADER_H
#define UTILS_ZIPLOCALHEADER_H
-#ifndef USE_PHYSFS
#include "localconsts.h"
@@ -42,5 +41,4 @@ struct ZipLocalHeader final
bool compressed;
};
-#endif // USE_PHYSFS
#endif // UTILS_ZIPLOCALHEADER_H
diff --git a/src/fs/virtfsfuncs.h b/src/fs/virtfsfuncs.h
index ad5f6c387..46bcd86ff 100644
--- a/src/fs/virtfsfuncs.h
+++ b/src/fs/virtfsfuncs.h
@@ -26,9 +26,7 @@
#include "localconsts.h"
struct VirtFile;
-#ifndef USE_PHYSFS
struct VirtFsEntry;
-#endif // USE_PHYSFS
struct VirtFsFuncs final
{
@@ -39,7 +37,6 @@ struct VirtFsFuncs final
fileLength(nullptr),
tell(nullptr),
seek(nullptr),
-#ifndef USE_PHYSFS
exists(nullptr),
getRealDir(nullptr),
enumerate(nullptr),
@@ -47,7 +44,6 @@ struct VirtFsFuncs final
openRead(nullptr),
openWrite(nullptr),
openAppend(nullptr),
-#endif
eof(nullptr)
{
}
@@ -67,7 +63,6 @@ struct VirtFsFuncs final
int64_t (*tell) (VirtFile *restrict const file);
int (*seek) (VirtFile *restrict const file,
const uint64_t pos);
-#ifndef USE_PHYSFS
bool (*exists) (VirtFsEntry *restrict const entry,
const std::string &filename,
const std::string &dirName);
@@ -87,7 +82,6 @@ struct VirtFsFuncs final
const std::string &filename);
VirtFile *(*openAppend) (VirtFsEntry *restrict const entry,
const std::string &filename);
-#endif // USE_PHYSFS
int (*eof) (VirtFile *restrict const file);
};
diff --git a/src/fs/virtfsrwops.cpp b/src/fs/virtfsrwops.cpp
index 036d8bb60..adb6fe0ea 100644
--- a/src/fs/virtfsrwops.cpp
+++ b/src/fs/virtfsrwops.cpp
@@ -431,4 +431,4 @@ void VirtFs::reportRWops()
}
#endif // DUMP_LEAKED_RESOURCES
-/* end of physfsrwops.c ... */
+/* end of virtfsrwops.c ... */
diff --git a/src/fs/virtfsrwops.h b/src/fs/virtfsrwops.h
index 82bb740de..2703044df 100644
--- a/src/fs/virtfsrwops.h
+++ b/src/fs/virtfsrwops.h
@@ -42,8 +42,8 @@
* Copyright (C) 2012-2017 The ManaPlus Developers
*/
-#ifndef UTILS_PHYSFSRWOPS_H
-#define UTILS_PHYSFSRWOPS_H
+#ifndef SRC_FS_VIRTFSRWOPS_H
+#define SRC_FS_VIRTFSRWOPS_H
#include "localconsts.h"
@@ -72,4 +72,4 @@ namespace VirtFs
#endif // DUMP_LEAKED_RESOURCES
} // namespace VirtFs
-#endif // UTILS_PHYSFSRWOPS_H
+#endif // SRC_FS_VIRTFSRWOPS_H