summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-28 22:49:10 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-28 22:49:10 +0300
commitdb31c2f832dd4067e4670dd469fe3b696188576b (patch)
tree7ed857adddd833cfd5087ee6c22e408637301c5c /src/fs
parent6583c1a039a28a41a865b02598e6da9521046325 (diff)
downloadmanaplus-db31c2f832dd4067e4670dd469fe3b696188576b.tar.gz
manaplus-db31c2f832dd4067e4670dd469fe3b696188576b.tar.bz2
manaplus-db31c2f832dd4067e4670dd469fe3b696188576b.tar.xz
manaplus-db31c2f832dd4067e4670dd469fe3b696188576b.zip
Add configure flag for use physfs.
New configure option: --without-physfs For now manaplus cant be compiled without physfs.
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/virtfs.cpp30
-rw-r--r--src/fs/virtfstools.cpp20
-rw-r--r--src/fs/virtfstools.h8
3 files changed, 44 insertions, 14 deletions
diff --git a/src/fs/virtfs.cpp b/src/fs/virtfs.cpp
index 7aa30940c..3ba214dc7 100644
--- a/src/fs/virtfs.cpp
+++ b/src/fs/virtfs.cpp
@@ -20,8 +20,11 @@
#include "fs/virtfs.h"
-#include "fs/virtfsdir.h"
+#ifdef USE_PHYSFS
#include "fs/virtfsphys.h"
+#else // USE_PHYSFS
+#include "fs/virtfsdir.h"
+#endif // USE_PHYSFS
#include "fs/virtfile.h"
#include "fs/virtfsfuncs.h"
#include "fs/virtlist.h"
@@ -34,33 +37,52 @@ 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)
@@ -147,8 +169,12 @@ namespace VirtFs
bool deinit()
{
- VirtFsDir::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/virtfstools.cpp b/src/fs/virtfstools.cpp
index c9e976864..39f1ed413 100644
--- a/src/fs/virtfstools.cpp
+++ b/src/fs/virtfstools.cpp
@@ -224,34 +224,36 @@ namespace VirtFs
}
} // namespace VirtFs
+#ifdef USE_PHYSFS
// +++ temporary add it here
-namespace VirtFsDir
+namespace VirtFsPhys
{
void getFiles(const std::string &path,
StringVect &list)
{
- VirtList *const fonts = VirtFsDir::enumerateFiles(path);
+ VirtList *const fonts = VirtFsPhys::enumerateFiles(path);
FOR_EACH (StringVectCIter, i, fonts->names)
{
- if (!VirtFsDir::isDirectory(path + dirSeparator + *i))
+ if (!VirtFsPhys::isDirectory(path + dirSeparator + *i))
list.push_back(*i);
}
- VirtFsDir::freeList(fonts);
+ VirtFsPhys::freeList(fonts);
}
} // namespace VirtFs
-
+#else // USE_PHYSFS
// +++ temporary add it here
-namespace VirtFsPhys
+namespace VirtFsDir
{
void getFiles(const std::string &path,
StringVect &list)
{
- VirtList *const fonts = VirtFsPhys::enumerateFiles(path);
+ VirtList *const fonts = VirtFsDir::enumerateFiles(path);
FOR_EACH (StringVectCIter, i, fonts->names)
{
- if (!VirtFsPhys::isDirectory(path + dirSeparator + *i))
+ if (!VirtFsDir::isDirectory(path + dirSeparator + *i))
list.push_back(*i);
}
- VirtFsPhys::freeList(fonts);
+ VirtFsDir::freeList(fonts);
}
} // namespace VirtFs
+#endif // USE_PHYSFS
diff --git a/src/fs/virtfstools.h b/src/fs/virtfstools.h
index 3271fee6f..383327404 100644
--- a/src/fs/virtfstools.h
+++ b/src/fs/virtfstools.h
@@ -51,18 +51,20 @@ namespace VirtFs
std::string loadTextFileString(const std::string &fileName);
} // namespace VirtFs
+#ifdef USE_PHYSFS
// +++ temporary add it here
-namespace VirtFsDir
+namespace VirtFsPhys
{
void getFiles(const std::string &path,
StringVect &list);
} // namespace VirtFs
-
+#else // USE_PHYSFS
// +++ temporary add it here
-namespace VirtFsPhys
+namespace VirtFsDir
{
void getFiles(const std::string &path,
StringVect &list);
} // namespace VirtFs
+#endif // USE_PHYSFS
#endif // UTILS_VIRTFSTOOLS_H