From b353cfd457e94ecfda4a78c1de2e0b473bd19b26 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 15 Jul 2012 08:54:00 -0700 Subject: [PATCH] Remove unused Mangle::VFS --- libs/mangle/vfs/clients/ogre_archive.cpp | 85 ------------- libs/mangle/vfs/clients/ogre_archive.hpp | 59 --------- libs/mangle/vfs/servers/ogre_vfs.cpp | 61 --------- libs/mangle/vfs/servers/ogre_vfs.hpp | 70 ----------- libs/mangle/vfs/servers/physfs_vfs.hpp | 71 ----------- libs/mangle/vfs/tests/.gitignore | 1 - libs/mangle/vfs/tests/Makefile | 25 ---- libs/mangle/vfs/tests/dummy_test.cpp | 42 ------- libs/mangle/vfs/tests/dummy_vfs.cpp | 117 ------------------ libs/mangle/vfs/tests/ogre_client_test.cpp | 39 ------ libs/mangle/vfs/tests/ogre_resource_test.cpp | 61 --------- libs/mangle/vfs/tests/ogre_server_test.cpp | 38 ------ libs/mangle/vfs/tests/output/dummy_test.out | 31 ----- .../vfs/tests/output/ogre_client_test.out | 12 -- .../vfs/tests/output/ogre_resource_test.out | 20 --- .../vfs/tests/output/ogre_server_test.out | 11 -- .../vfs/tests/output/physfs_server_test.out | 11 -- libs/mangle/vfs/tests/physfs_server_test.cpp | 21 ---- libs/mangle/vfs/tests/server_common.cpp | 33 ----- libs/mangle/vfs/tests/test.sh | 18 --- libs/mangle/vfs/tests/test.zip | Bin 169 -> 0 bytes libs/mangle/vfs/vfs.hpp | 87 ------------- 22 files changed, 913 deletions(-) delete mode 100644 libs/mangle/vfs/clients/ogre_archive.cpp delete mode 100644 libs/mangle/vfs/clients/ogre_archive.hpp delete mode 100644 libs/mangle/vfs/servers/ogre_vfs.cpp delete mode 100644 libs/mangle/vfs/servers/ogre_vfs.hpp delete mode 100644 libs/mangle/vfs/servers/physfs_vfs.hpp delete mode 100644 libs/mangle/vfs/tests/.gitignore delete mode 100644 libs/mangle/vfs/tests/Makefile delete mode 100644 libs/mangle/vfs/tests/dummy_test.cpp delete mode 100644 libs/mangle/vfs/tests/dummy_vfs.cpp delete mode 100644 libs/mangle/vfs/tests/ogre_client_test.cpp delete mode 100644 libs/mangle/vfs/tests/ogre_resource_test.cpp delete mode 100644 libs/mangle/vfs/tests/ogre_server_test.cpp delete mode 100644 libs/mangle/vfs/tests/output/dummy_test.out delete mode 100644 libs/mangle/vfs/tests/output/ogre_client_test.out delete mode 100644 libs/mangle/vfs/tests/output/ogre_resource_test.out delete mode 100644 libs/mangle/vfs/tests/output/ogre_server_test.out delete mode 100644 libs/mangle/vfs/tests/output/physfs_server_test.out delete mode 100644 libs/mangle/vfs/tests/physfs_server_test.cpp delete mode 100644 libs/mangle/vfs/tests/server_common.cpp delete mode 100755 libs/mangle/vfs/tests/test.sh delete mode 100644 libs/mangle/vfs/tests/test.zip delete mode 100644 libs/mangle/vfs/vfs.hpp diff --git a/libs/mangle/vfs/clients/ogre_archive.cpp b/libs/mangle/vfs/clients/ogre_archive.cpp deleted file mode 100644 index 2d3f7c520..000000000 --- a/libs/mangle/vfs/clients/ogre_archive.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "ogre_archive.hpp" - -#include "../../stream/clients/ogre_datastream.hpp" - -using namespace Mangle::VFS; -using namespace Mangle::Stream; - -Ogre::DataStreamPtr MangleArchive::open(const Ogre::String& filename) const -{ - return Ogre::DataStreamPtr(new Mangle2OgreStream - (filename, vfs->open(filename))); -} - -static void fill(Ogre::FileInfoList &out, FileInfoList &in) -{ - int size = in.size(); - out.resize(size); - - for(int i=0; ihasList); - FileInfoListPtr lst = vfs->list("", recursive, dirs); - Ogre::StringVector *res = new Ogre::StringVector; - - fill(*res, *lst); - - return Ogre::StringVectorPtr(res); -} - -Ogre::FileInfoListPtr MangleArchive::listFileInfo(bool recursive, bool dirs) -{ - assert(vfs->hasList); - FileInfoListPtr lst = vfs->list("", recursive, dirs); - Ogre::FileInfoList *res = new Ogre::FileInfoList; - - fill(*res, *lst); - - return Ogre::FileInfoListPtr(res); -} - -// Find functions will only work if vfs->hasFind is set. -Ogre::StringVectorPtr MangleArchive::find(const Ogre::String& pattern, - bool recursive, - bool dirs) -{ - assert(vfs->hasFind); - FileInfoListPtr lst = vfs->find(pattern, recursive, dirs); - Ogre::StringVector *res = new Ogre::StringVector; - - fill(*res, *lst); - - return Ogre::StringVectorPtr(res); -} - -Ogre::FileInfoListPtr MangleArchive::findFileInfo(const Ogre::String& pattern, - bool recursive, - bool dirs) -{ - assert(vfs->hasFind); - FileInfoListPtr lst = vfs->find(pattern, recursive, dirs); - Ogre::FileInfoList *res = new Ogre::FileInfoList; - - fill(*res, *lst); - - return Ogre::FileInfoListPtr(res); -} diff --git a/libs/mangle/vfs/clients/ogre_archive.hpp b/libs/mangle/vfs/clients/ogre_archive.hpp deleted file mode 100644 index 7b371c6ef..000000000 --- a/libs/mangle/vfs/clients/ogre_archive.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef MANGLE_VFS_OGRECLIENT_H -#define MANGLE_VFS_OGRECLIENT_H - -#include -#include -#include "../vfs.hpp" - -namespace Mangle { -namespace VFS { - -/** An OGRE Archive implementation that wraps a Mangle::VFS - filesystem. - - This has been built and tested against OGRE 1.6.2, and has been - extended for OGRE 1.7. You might have to make your own - modifications if you're working with newer (or older) versions. - */ -class MangleArchive : public Ogre::Archive -{ - VFSPtr vfs; - - public: - MangleArchive(VFSPtr _vfs, const std::string &name, - const std::string &archType = "Mangle") - : Ogre::Archive(name, archType) - , vfs(_vfs) - {} - - bool isCaseSensitive() const { return vfs->isCaseSensitive; } - - // These do nothing. You have to load / unload the archive in the - // constructor/destructor. - void load() {} - void unload() {} - - bool exists(const Ogre::String& filename) - { return vfs->isFile(filename); } - - time_t getModifiedTime(const Ogre::String& filename) - { return vfs->stat(filename)->time; } - - // With both these we support both OGRE 1.6 and 1.7 - Ogre::DataStreamPtr open(const Ogre::String& filename) const; - Ogre::DataStreamPtr open(const Ogre::String& filename, bool readOnly) const - { return open(filename); } - - Ogre::StringVectorPtr list(bool recursive = true, bool dirs = false); - Ogre::FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false); - - // Find functions will only work if vfs->hasFind is set. - Ogre::StringVectorPtr find(const Ogre::String& pattern, bool recursive = true, - bool dirs = false); - Ogre::FileInfoListPtr findFileInfo(const Ogre::String& pattern, - bool recursive = true, - bool dirs = false); -}; - -}} // namespaces -#endif diff --git a/libs/mangle/vfs/servers/ogre_vfs.cpp b/libs/mangle/vfs/servers/ogre_vfs.cpp deleted file mode 100644 index 7f728c1b0..000000000 --- a/libs/mangle/vfs/servers/ogre_vfs.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "ogre_vfs.hpp" -#include "../../stream/servers/ogre_datastream.hpp" - -using namespace Mangle::VFS; -using namespace Mangle::Stream; - -OgreVFS::OgreVFS(const std::string &_group) - : group(_group) -{ - hasList = true; - hasFind = true; - isCaseSensitive = true; - - // Get the group manager once - gm = Ogre::ResourceGroupManager::getSingletonPtr(); - - // Use the default group if none was specified - if(group.empty()) - group = gm->getWorldResourceGroupName(); -} - -StreamPtr OgreVFS::open(const std::string &name) -{ - Ogre::DataStreamPtr data = gm->openResource(name, group); - return StreamPtr(new OgreStream(data)); -} - -static void fill(FileInfoList &out, Ogre::FileInfoList &in, bool dirs) -{ - int size = in.size(); - out.resize(size); - - for(int i=0; ilistResourceFileInfo(group, dirs); - FileInfoListPtr res(new FileInfoList); - fill(*res, *olist, dirs); - return res; -} - -FileInfoListPtr OgreVFS::find(const std::string& pattern, - bool recursive, - bool dirs) const -{ - Ogre::FileInfoListPtr olist = gm->findResourceFileInfo(group, pattern, dirs); - FileInfoListPtr res(new FileInfoList); - fill(*res, *olist, dirs); - return res; -} diff --git a/libs/mangle/vfs/servers/ogre_vfs.hpp b/libs/mangle/vfs/servers/ogre_vfs.hpp deleted file mode 100644 index 7ab64169d..000000000 --- a/libs/mangle/vfs/servers/ogre_vfs.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef MANGLE_VFS_OGRESERVER_H -#define MANGLE_VFS_OGRESERVER_H - -#include "../vfs.hpp" -#include - -namespace Mangle { -namespace VFS { - -/** @brief An interface into the OGRE VFS system. - - This class does NOT wrap a single Ogre::Archive, but rather an - entire resource group in Ogre. You can use this class to tap into - all paths, Zip files, custom archives on so on that have been - inserted into Ogre as resource locations. - - This has been built and tested against OGRE 1.6.2. You might have - to make your own modifications if you're working with newer (or - older) versions. - */ -class OgreVFS : public VFS -{ - std::string group; - Ogre::ResourceGroupManager *gm; - - public: - /** @brief Constructor - - OGRE must be initialized (ie. you must have created an - Ogre::Root object somewhere) before calling this. - - @param group Optional resource group name. If none is given, - OGRE's default (or 'World') resource group is used. - */ - OgreVFS(const std::string &_group = ""); - - /// Open a new data stream. Deleting the object should be enough to - /// close it. - virtual Stream::StreamPtr open(const std::string &name); - - /// Check for the existence of a file - virtual bool isFile(const std::string &name) const - { return gm->resourceExists(group, name); } - - /// This doesn't work, always returns false. - virtual bool isDir(const std::string &name) const - { return false; } - - /// This doesn't work. - virtual FileInfoPtr stat(const std::string &name) const - { return FileInfoPtr(); } - - /// List all entries in a given directory. A blank dir should be - /// interpreted as a the root/current directory of the archive. If - /// dirs is true, list directories instead of files. OGRE note: The - /// ogre resource systemd does not support recursive listing of - /// files. We might make a separate filter for this later. - virtual FileInfoListPtr list(const std::string& dir = "", - bool recurse=true, - bool dirs=false) const; - - /// Find files after a given pattern. Wildcards (*) are - /// supported. - virtual FileInfoListPtr find(const std::string& pattern, - bool recursive=true, - bool dirs=false) const; -}; - -}} // namespaces -#endif diff --git a/libs/mangle/vfs/servers/physfs_vfs.hpp b/libs/mangle/vfs/servers/physfs_vfs.hpp deleted file mode 100644 index 8535088e0..000000000 --- a/libs/mangle/vfs/servers/physfs_vfs.hpp +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef MANGLE_VFS_PHYSFS_SERVER_H -#define MANGLE_VFS_PHYSFS_SERVER_H - -#include "../vfs.hpp" -#include "../../stream/servers/phys_stream.hpp" - -#include -#include - -namespace Mangle { -namespace VFS { - -/** @brief An interface into the PhysFS virtual file system library - - You have to set up PhysFS on your own before using this class. - */ -class PhysVFS : public VFS -{ - public: - PhysVFS() - { - hasList = true; - hasFind = false; - isCaseSensitive = true; - } - - /// Open a new data stream. Deleting the object should be enough to - /// close it. - virtual Stream::StreamPtr open(const std::string &name) - { return Stream::StreamPtr(new Stream::PhysFile(PHYSFS_openRead(name.c_str()))); } - - /// Check for the existence of a file - virtual bool isFile(const std::string &name) const - { return PHYSFS_exists(name.c_str()); } - - /// Checks for a directory - virtual bool isDir(const std::string &name) const - { return PHYSFS_isDirectory(name.c_str()); } - - /// This doesn't work - virtual FileInfoPtr stat(const std::string &name) const - { assert(0); return FileInfoPtr(); } - - virtual FileInfoListPtr list(const std::string& dir = "", - bool recurse=true, - bool dirs=false) const - { - char **files = PHYSFS_enumerateFiles(dir.c_str()); - FileInfoListPtr lst(new FileInfoList); - - // Add all teh files - int i = 0; - while(files[i] != NULL) - { - FileInfo fi; - fi.name = files[i]; - fi.isDir = false; - - lst->push_back(fi); - } - return lst; - } - - virtual FileInfoListPtr find(const std::string& pattern, - bool recursive=true, - bool dirs=false) const - { assert(0); } -}; - -}} // namespaces -#endif diff --git a/libs/mangle/vfs/tests/.gitignore b/libs/mangle/vfs/tests/.gitignore deleted file mode 100644 index 814490404..000000000 --- a/libs/mangle/vfs/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*_test diff --git a/libs/mangle/vfs/tests/Makefile b/libs/mangle/vfs/tests/Makefile deleted file mode 100644 index a5d1d1712..000000000 --- a/libs/mangle/vfs/tests/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -GCC=g++ -I../ -Wall - -all: dummy_test ogre_client_test ogre_resource_test ogre_server_test physfs_server_test - -I_OGRE=$(shell pkg-config --cflags OGRE) -L_OGRE=$(shell pkg-config --libs OGRE) -L_PHYSFS=-lphysfs - -ogre_client_test: ogre_client_test.cpp dummy_vfs.cpp ../vfs.hpp ../clients/ogre_archive.hpp ../clients/ogre_archive.cpp - $(GCC) $< ../clients/ogre_archive.cpp -o $@ $(I_OGRE) $(L_OGRE) - -ogre_resource_test: ogre_resource_test.cpp - $(GCC) $< -o $@ $(I_OGRE) $(L_OGRE) - -ogre_server_test: ogre_server_test.cpp ../vfs.hpp ../servers/ogre_vfs.hpp ../servers/ogre_vfs.cpp - $(GCC) $< -o $@ $(I_OGRE) $(L_OGRE) ../servers/ogre_vfs.cpp - -physfs_server_test: physfs_server_test.cpp ../vfs.hpp ../servers/physfs_vfs.hpp - $(GCC) $< -o $@ $(L_PHYSFS) - -dummy_test: dummy_test.cpp dummy_vfs.cpp ../vfs.hpp - $(GCC) $< -o $@ - -clean: - rm *_test diff --git a/libs/mangle/vfs/tests/dummy_test.cpp b/libs/mangle/vfs/tests/dummy_test.cpp deleted file mode 100644 index 541010c6a..000000000 --- a/libs/mangle/vfs/tests/dummy_test.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "dummy_vfs.cpp" - -#include -#include - -using namespace std; - -void print(FileInfo &inf) -{ - cout << "name: " << inf.name << endl; - cout << "basename: " << inf.basename << endl; - cout << "isDir: " << inf.isDir << endl; - cout << "size: " << inf.size << endl; - cout << "time: " << inf.time << endl; -} -void print(FileInfoPtr inf) { print(*inf); } - -void print(FileInfoList &lst) -{ - for(unsigned i=0; isize() << endl; - - return 0; -} diff --git a/libs/mangle/vfs/tests/dummy_vfs.cpp b/libs/mangle/vfs/tests/dummy_vfs.cpp deleted file mode 100644 index 0448e96a5..000000000 --- a/libs/mangle/vfs/tests/dummy_vfs.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// This file is shared between several test programs -#include "vfs.hpp" -#include -#include - -#include "../../stream/servers/memory_stream.hpp" - -using namespace Mangle::VFS; -using namespace Mangle::Stream; - -class DummyVFS : public VFS -{ -public: - DummyVFS() - { - hasFind = false; - hasList = true; - isCaseSensitive = true; - } - - // We only support opening 'file1' at the moment. - StreamPtr open(const std::string &name) - { - assert(name == "file1"); - return StreamPtr(new MemoryStream("hello world", 11)); - } - - bool isFile(const std::string &name) const - { - return (name == "file1" || - name == "dir/file2"); - } - - bool isDir(const std::string &name) const - { - return name == "dir"; - } - - /// Get info about a single file - FileInfoPtr stat(const std::string &name) const - { - FileInfoPtr fi(new FileInfo); - fi->name = name; - fi->time = 0; - - if(isFile(name)) - { - if(name == "dir/file2") - { - fi->basename = "file2"; - fi->size = 2; - } - else - { - fi->basename = "file1"; - fi->size = 1; - } - fi->isDir = false; - } - else if(isDir(name)) - { - fi->basename = "dir"; - fi->isDir = true; - fi->size = 0; - } - else assert(0); - - return fi; - } - - /// List all entries in a given directory. A blank dir should be - /// interpreted as a the root/current directory of the archive. If - /// dirs is true, list directories instead of files. - virtual FileInfoListPtr list(const std::string& dir = "", - bool recurse=true, - bool dirs=false) const - { - assert(dir == ""); - - FileInfoListPtr fl(new FileInfoList); - - FileInfo fi; - - if(!dirs) - { - fi.name = "file1"; - fi.basename = "file1"; - fi.isDir = false; - fi.size = 1; - fi.time = 0; - fl->push_back(fi); - - if(recurse) - { - fi.name = "dir/file2"; - fi.basename = "file2"; - fi.size = 2; - fl->push_back(fi); - } - } - else - { - fi.name = "dir"; - fi.basename = "dir"; - fi.isDir = true; - fi.size = 0; - fi.time = 0; - fl->push_back(fi); - } - return fl; - } - - FileInfoListPtr find(const std::string& pattern, - bool recursive=true, - bool dirs=false) const - { assert(0); } -}; diff --git a/libs/mangle/vfs/tests/ogre_client_test.cpp b/libs/mangle/vfs/tests/ogre_client_test.cpp deleted file mode 100644 index 8e1269b56..000000000 --- a/libs/mangle/vfs/tests/ogre_client_test.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "dummy_vfs.cpp" -#include "../clients/ogre_archive.hpp" -#include - -using namespace Ogre; -using namespace std; - -void print(StringVectorPtr lst) -{ - int s = lst->size(); - - for(int i=0; isize() << endl; - cout << "contents: " << file->getAsString() << endl; - - return 0; -} diff --git a/libs/mangle/vfs/tests/ogre_resource_test.cpp b/libs/mangle/vfs/tests/ogre_resource_test.cpp deleted file mode 100644 index 8965adaa1..000000000 --- a/libs/mangle/vfs/tests/ogre_resource_test.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include -#include - -/* - This isn't really a test of our implementation, but a test of using - the Ogre resource system to find files. If the Ogre interface - changes and you have to change this test, you will have to change - the servers/ogre_vfs.cpp implementation equivalently. - - */ - -using namespace std; -using namespace Ogre; - -ResourceGroupManager *gm; -String group; - -void find(const std::string &fileName) -{ - cout << "\nFile: " << fileName << endl; - - if(!gm->resourceExists(group, fileName)) - { - cout << "Does not exist\n"; - return; - } - - DataStreamPtr data = gm->openResource(fileName, group); - - cout << "Size: " << data->size() << endl; - cout << "First line: " << data->getLine() << "\n"; -} - -int main() -{ - // Disable logging - new LogManager; - Log *log = LogManager::getSingleton().createLog(""); - log->setDebugOutputEnabled(false); - - // Set up Ogre - Root root("","",""); - - root.addResourceLocation("./", "FileSystem", "General"); - - gm = ResourceGroupManager::getSingletonPtr(); - group = gm->getWorldResourceGroupName(); - - find("Makefile"); - find("ogre_resource_test.cpp"); - find("bleh"); - - cout << "\nAll source files:\n"; - FileInfoListPtr list = gm->findResourceFileInfo(group, "*.cpp"); - FileInfoList::iterator it, end; - it = list->begin(); - end = list->end(); - for(; it != end; it++) - cout << " " << it->filename << endl; -} diff --git a/libs/mangle/vfs/tests/ogre_server_test.cpp b/libs/mangle/vfs/tests/ogre_server_test.cpp deleted file mode 100644 index b846eef96..000000000 --- a/libs/mangle/vfs/tests/ogre_server_test.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "../servers/ogre_vfs.hpp" - -#include - -#include "server_common.cpp" - -Ogre::Root *root; - -void setupOgre() -{ - using namespace Ogre; - - // Disable logging - new LogManager; - Log *log = LogManager::getSingleton().createLog(""); - log->setDebugOutputEnabled(false); - - // Set up Root - root = new Root("","",""); - - // Add a zip file and the current directory - root->addResourceLocation("test.zip", "Zip", "General"); - root->addResourceLocation("./", "FileSystem", "General"); -} - -int main() -{ - // Set up the engine - setupOgre(); - - // This is our entry point into the resource file system - OgreVFS vfs("General"); - - // Run the test - testAll(vfs); - - return 0; -} diff --git a/libs/mangle/vfs/tests/output/dummy_test.out b/libs/mangle/vfs/tests/output/dummy_test.out deleted file mode 100644 index 61f1fda80..000000000 --- a/libs/mangle/vfs/tests/output/dummy_test.out +++ /dev/null @@ -1,31 +0,0 @@ -Listing all files: -name: file1 -basename: file1 -isDir: 0 -size: 1 -time: 0 -name: dir/file2 -basename: file2 -isDir: 0 -size: 2 -time: 0 - -Stat for single files: -name: file1 -basename: file1 -isDir: 0 -size: 1 -time: 0 - -name: dir/file2 -basename: file2 -isDir: 0 -size: 2 -time: 0 - -name: dir -basename: dir -isDir: 1 -size: 0 -time: 0 -filesize: 11 diff --git a/libs/mangle/vfs/tests/output/ogre_client_test.out b/libs/mangle/vfs/tests/output/ogre_client_test.out deleted file mode 100644 index bc10b1e5c..000000000 --- a/libs/mangle/vfs/tests/output/ogre_client_test.out +++ /dev/null @@ -1,12 +0,0 @@ -Case: 1 -Name: dummy -Type: Mangle -All files: - file1 - dir/file2 -Non-recursive: - file1 -Dirs: - dir -filesize: 11 -contents: hello world diff --git a/libs/mangle/vfs/tests/output/ogre_resource_test.out b/libs/mangle/vfs/tests/output/ogre_resource_test.out deleted file mode 100644 index 9bfc4ff5b..000000000 --- a/libs/mangle/vfs/tests/output/ogre_resource_test.out +++ /dev/null @@ -1,20 +0,0 @@ - -File: Makefile -Size: 828 -First line: GCC=g++ -I../ - -File: ogre_resource_test.cpp -Size: 1437 -First line: #include - -File: bleh -Does not exist - -All source files: - physfs_server_test.cpp - dummy_test.cpp - ogre_resource_test.cpp - server_common.cpp - dummy_vfs.cpp - ogre_client_test.cpp - ogre_server_test.cpp diff --git a/libs/mangle/vfs/tests/output/ogre_server_test.out b/libs/mangle/vfs/tests/output/ogre_server_test.out deleted file mode 100644 index 74f350844..000000000 --- a/libs/mangle/vfs/tests/output/ogre_server_test.out +++ /dev/null @@ -1,11 +0,0 @@ - -File: Makefile -Size: 828 -First 12 bytes: GCC=g++ -I.. - -File: testfile.txt -Size: 13 -First 12 bytes: hello world! - -File: blah_bleh -File doesn't exist diff --git a/libs/mangle/vfs/tests/output/physfs_server_test.out b/libs/mangle/vfs/tests/output/physfs_server_test.out deleted file mode 100644 index 74f350844..000000000 --- a/libs/mangle/vfs/tests/output/physfs_server_test.out +++ /dev/null @@ -1,11 +0,0 @@ - -File: Makefile -Size: 828 -First 12 bytes: GCC=g++ -I.. - -File: testfile.txt -Size: 13 -First 12 bytes: hello world! - -File: blah_bleh -File doesn't exist diff --git a/libs/mangle/vfs/tests/physfs_server_test.cpp b/libs/mangle/vfs/tests/physfs_server_test.cpp deleted file mode 100644 index 9e9d088cd..000000000 --- a/libs/mangle/vfs/tests/physfs_server_test.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "../servers/physfs_vfs.hpp" - -#include "server_common.cpp" - -#include - -int main() -{ - // Set up the library and paths - PHYSFS_init("blah"); - PHYSFS_addToSearchPath("test.zip", 1); - PHYSFS_addToSearchPath("./", 1); - - // Create our interface - PhysVFS vfs; - - // Run the test - testAll(vfs); - - return 0; -} diff --git a/libs/mangle/vfs/tests/server_common.cpp b/libs/mangle/vfs/tests/server_common.cpp deleted file mode 100644 index 1834bc25a..000000000 --- a/libs/mangle/vfs/tests/server_common.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace Mangle::VFS; -using namespace Mangle::Stream; -using namespace std; - -void find(VFS &vfs, const std::string &file) -{ - cout << "\nFile: " << file << endl; - - if(!vfs.isFile(file)) - { - cout << "File doesn't exist\n"; - return; - } - - StreamPtr data = vfs.open(file); - - cout << "Size: " << data->size() << endl; - - char buf[13]; - buf[12] = 0; - data->read(buf, 12); - - cout << "First 12 bytes: " << buf << "\n"; -} - -void testAll(VFS &vfs) -{ - find(vfs, "Makefile"); // From the file system - find(vfs, "testfile.txt"); // From the zip - find(vfs, "blah_bleh"); // Doesn't exist -} diff --git a/libs/mangle/vfs/tests/test.sh b/libs/mangle/vfs/tests/test.sh deleted file mode 100755 index 2d07708ad..000000000 --- a/libs/mangle/vfs/tests/test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -make || exit - -mkdir -p output - -PROGS=*_test - -for a in $PROGS; do - if [ -f "output/$a.out" ]; then - echo "Running $a:" - ./$a | diff output/$a.out - - else - echo "Creating $a.out" - ./$a > "output/$a.out" - git add "output/$a.out" - fi -done diff --git a/libs/mangle/vfs/tests/test.zip b/libs/mangle/vfs/tests/test.zip deleted file mode 100644 index ec82f8bc6be46902264847237d30818665e89072..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 169 zcmWIWW@h1H0D;ZXv#htQzs|@DWP>mdgD68uYH>+gW=^VJNkvI$2qy#cq^G9dGk`d> zf`#D)^9$yT)SR4rh4TEOoD@Z_0B=Snab{emfy`uJUcwofH({Q*9Ik` diff --git a/libs/mangle/vfs/vfs.hpp b/libs/mangle/vfs/vfs.hpp deleted file mode 100644 index 258a6b0a0..000000000 --- a/libs/mangle/vfs/vfs.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef MANGLE_VFS_H -#define MANGLE_VFS_H - -#include "../stream/stream.hpp" -#include -#include - -namespace Mangle { -namespace VFS { - -/// Generic file info structure -struct FileInfo -{ - /// Full name, including path - std::string name; - - /// Base name, not including path - std::string basename; - - /// Is this a directory? - bool isDir; - - /// File size - size_t size; - - /// Last modification date - time_t time; -}; - -typedef std::vector FileInfoList; - -typedef boost::shared_ptr FileInfoPtr; -typedef boost::shared_ptr FileInfoListPtr; - -/** An interface to any file system or other provider of named data - streams -*/ -class VFS -{ - public: - // Feature options. These should be set in the constructor. - - /// If true, the list() function work - bool hasList; - - /// If true, the find() function work - bool hasFind; - - /// If true, the file system is case sensitive - bool isCaseSensitive; - - /// Virtual destructor - virtual ~VFS() {} - - /// Open a new data stream. Deleting the object (letting all the - /// pointers to it go out of scope) should be enough to close it. - virtual Stream::StreamPtr open(const std::string &name) = 0; - - /// Check for the existence of a file - virtual bool isFile(const std::string &name) const = 0; - - /// Check for the existence of a directory - virtual bool isDir(const std::string &name) const = 0; - - /// Get info about a single file - virtual FileInfoPtr stat(const std::string &name) const = 0; - - /// List all entries in a given directory. A blank dir should be - /// interpreted as a the root/current directory of the archive. If - /// dirs is true, list directories instead of files. - virtual FileInfoListPtr list(const std::string& dir = "", - bool recurse=true, - bool dirs=false) const = 0; - - /// Find files after a given pattern. Wildcards (*) are - /// supported. Only valid if 'hasFind' is true. Don't implement your - /// own pattern matching here if the backend doesn't support it - /// natively; use a filter instead. - virtual FileInfoListPtr find(const std::string& pattern, - bool recursive=true, - bool dirs=false) const = 0; -}; - -typedef boost::shared_ptr VFSPtr; - -}} // namespaces -#endif